File tree Expand file tree Collapse file tree
client/app/visualizations/chart Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,9 +251,18 @@ function ChartEditor(ColorPalette, clientConfig) {
251251 scope . options . legend = { enabled : true } ;
252252 }
253253
254- if ( ! has ( scope . options , 'xAxisLabelLength' ) ) {
255- scope . options . xAxisLabelLength = 300 ;
256- }
254+ scope . $watch ( 'options.globalSeriesType' , ( newType , oldType ) => {
255+ const defaultXAxisLength = 10 ;
256+ if ( ! has ( scope . options , 'xAxisLabelLength' ) ) {
257+ scope . options . xAxisLabelLength = defaultXAxisLength ;
258+ }
259+ if ( oldType !== newType ) {
260+ scope . options . xAxisLabelLength = defaultXAxisLength ;
261+ if ( newType === 'pie' ) {
262+ scope . options . xAxisLabelLength = 300 ;
263+ }
264+ }
265+ } , true ) ;
257266
258267 if ( scope . columnNames ) {
259268 each ( scope . options . columnMapping , ( value , key ) => {
Original file line number Diff line number Diff line change @@ -230,7 +230,8 @@ function prepareChartData(seriesList, options) {
230230 const yValues = [ ] ;
231231 const yErrorValues = [ ] ;
232232 each ( data , ( row ) => {
233- const x = normalizeValue ( row . x ) ;
233+ const xAxisLabelLength = parseInt ( options . xAxisLabelLength , 10 ) || DEFAULT_XAXIS_LABEL_LENGTH ;
234+ const x = normalizeValue ( row . x ) . substr ( 0 , xAxisLabelLength ) ;
234235 const y = normalizeValue ( row . y ) ;
235236 const yError = normalizeValue ( row . yError ) ;
236237 sourceData . set ( x , {
You can’t perform that action at this time.
0 commit comments