Issue #663 open

replot({resetAxes:['yaxis']}) cause NaN in Y axis.

Anonymous created an issue

I have the following axis setup:

jqPlot v 1.0.0b2.

#!JavaScript
axesDefaults:{
            show:false, // whether or not to renderer the axis. Determined automatically.
            renderer:$.jqplot.LinearAxisRenderer,
            rendererOptions:{
                baselineWidth:2,
                baselineColor:'#BDBDBD',
                drawBaseline:false
            },
            //borderWidth: 2, // width of line stroked at the border of the axis.
            //borderColor: '#BDBDBD', // color of the border adjacent to the axis.
            min:null, // minimum numerical value of the axis. Determined automatically.
            max:null, // maximum numerical value of the axis. Determined automatically.
            pad:1.0, // a factor multiplied by the data range on the axis  to give the axis range so that data points don't fall on the edges of the axis.
            autoscale:null,
            forceTickAt0:false,
            forceTickAt100:false,
            numberTicks:null,
            tickOptions:{
                mark:'cross', // Where to put the tick mark on the axis 'outside', 'inside' or 'cross',
                markSize:4, // length the tick will extend beyond the grid in pixels. For 'cross', length will be added above and below the grid boundary,
                show:false, // whether to show the tick (mark and label),
                showGridline:false, // whether to draw a gridline (across the whole grid) at this tick,
                showLabel:false, // whether to show the text label at the tick,
                showMark:false // whether to show the mark at the tick,
                //formatString:'' // format string to use with the axis tick formatter
            },
            showTicks:false, // whether or not to show the tick labels,
            showTickMarks:false // whether or not to show the tick marks
        },
        axes:{
            xaxis:{
                show:true,
                renderer:$.jqplot.DateAxisRenderer,
                min:null,
                max:null,
                numberTicks:2,
                autoscale:false

                /*
                tickOptions:{
                    formatString:'%M:%S'
                 }
                */
            },
            yaxis:{
                show:true,
                rendererOptions:{
                    drawBaseline:false,
                    tickInset:0.2
                },
                min:null,
                max:null,
                numberTicks:11,
                pad:1.1,
                autoscale:false,
                tickOptions:{
                    mark:'inside',
                    markSize:6,
                    show:true,
                    showMark:true,
                    showLabel:true
                },
                showTicks:true,
                showTickMarks:true
            }
        }

So the problem here is that when i have series data with different X values but with the same Y values line is not drawn in the chart when jqPlot.replot() is used. Instead labels in the Y axis are shrinked to just one label saying "NaN" and nothing is drawn on the chart.

However when I enable autoscale for Y axis and remove {resetAxes:['yaxis']} from "replot()" method call everything is fine and horizontal line is drawn on the chart.

I've determined that replot({resetAxes:['yaxis']}) needs at least 2 different values to calculate min and max of the axis. I'm kinda stuck here because i need to use numberTicks and tickInset at the same time and if I omit the {resetAxes:['yaxis']} then axis labels (HTML values) shrink with each replot. Also i noticed that setting autoscale: true for the Y axis fixes an issue when sometimes chart is not scaled if current value becomes less than the min value.

Not sure if this bug is reported somewhere, sorry if it is. I looked but wasn't able to find anything. I can post my JS code which is used to create chart options, to add data to the series and replot the chart.

Thanks in advance.

Comments (1)

  1. Log in to comment