Missing Y-AXIS labels in line charts when plotting 0 values

Hello. We just encountered a scenario where in DHTMLx line chart does not generate the Y_Axis labels of line charts when data point values consist only of zeros. Below is an example of the JSON data we are feeding the chart. Also attached is the completed demo to replicate the issue described.

var testData=[
{ “Actual”:“null”, “Target”:“null”, “month”:“Jan” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Feb” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Mar” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Apr” },
{ “Actual”:“null”, “Target”:“null”, “month”:“May” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Jun” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Jul” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Aug” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Sep” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Oct” },
{ “Actual”:“null”, “Target”:“null”, “month”:“Nov” },
{ “Actual”:“0.0”, “Target”:“0.0”, “month”:“Dec” }];
Completed Demo_Blank_Y_AXIS_Labels.zip (283 KB)

If you will use 0 instead of null - chart will render line correctly.

We need to distinguish nulls from zeros, meaning there would really be months were we do not have data yet (months in the future) and as each month passes, we populate data (Actual and Target values) which would be numeric/non-null values.

If I put zeros in place of all nulls, even for future months which we supposedly do not have data for, then DHTMLx graph will create a line along the zero Y-AXIS value which is not the expected result.

Is there a chance that DHTMLx will support null values as a valid data point? :smiley:

I see the problem. It doesn’t really related to the null values, but to the fact that you have only one valid value in the dataset and that value is “0”. This is the only case for which automatic scale doesn’t work. If you will have any other value different from 0 - vertical scale will render self correctly.

We will fix issue with auto-scale for zero value in next few days.


I have attached fixed libs. Please try them
libs.zip (76.4 KB)

It worked! Thanks for your help!