Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
fix: exception thrown for charts without a x-axis (#36)
Browse files Browse the repository at this point in the history
* fix: pie chart exception

* fix: incoporate krist's feedbacl
  • Loading branch information
khtruong authored and kristw committed Apr 1, 2019
1 parent 2dfa077 commit 04cae86
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,17 @@ function nvd3Vis(element, props) {
if (chart.x2Axis && chart.x2Axis.tickFormat) {
chart.x2Axis.tickFormat(xAxisFormatter);
}
const isXAxisString = isVizTypes(['dist_bar', 'box_plot']);
if (!isXAxisString && chart.xAxis && chart.xAxis.tickFormat) {
chart.xAxis.tickFormat(xAxisFormatter);
} else {
chart.xAxis.tickFormat(d =>
d.length > MAX_NO_CHARACTERS_IN_LABEL
? `${d.substring(0, MAX_NO_CHARACTERS_IN_LABEL)}…`
: d,
);
if (chart.xAxis && chart.xAxis.tickFormat) {
const isXAxisString = isVizTypes(['dist_bar', 'box_plot']);
if (isXAxisString) {
chart.xAxis.tickFormat(d =>
d.length > MAX_NO_CHARACTERS_IN_LABEL
? `${d.substring(0, MAX_NO_CHARACTERS_IN_LABEL)}…`
: d,
);
} else {
chart.xAxis.tickFormat(xAxisFormatter);
}
}

let yAxisFormatter = getTimeOrNumberFormatter(yAxisFormat);
Expand Down

0 comments on commit 04cae86

Please sign in to comment.