using google chart i plotted a line chart like this.
In the graph i have created a custom tool tip as shown in the jfiddle. In the above graph there is no problems with displaying the chart with tool tip.
Am fetching chart data from db.Based on some chart data am not able to render the chart due to some js erros.
in the below example i changed the chart data and graph is not diplaying due to js erros in line 57 of jfidle code
im facing more script issues inside below method whenever the chart data varies.
function toolTipVal(dt, row, index1, index2) {
label1 = dt.getColumnLabel(index1).split("\n");
label2 = dt.getColumnLabel(index2).split("\n");
yValue1 =0; yValue2 =0;
if (dt.getValue(row, index1) === null ) {
yValue1 = dt.getFormattedValue(row -1, index1);
}
else {
yValue1 = dt.getFormattedValue(row, index1);
}
if (dt.getValue(row, index2) === null) {
if (row > 0) {
yValue2 = dt.getFormattedValue(row - 1, index2);
}
} else {
yValue2 = dt.getFormattedValue(row, index2);
}
return [yValue1, yValue2, label1, label2];
};
If am using the second data set in jfiddle am getting follwoing js error
jsapi_compiled_default_module.js:74 Uncaught (in promise) Error: Invalid row index -1. Should be in the range [0-799] in above methodline
yValue1 = dt.getFormattedValue(row -1, index1);
due to this graph is not rendering in the UI.
How can i modify the above method based on these chart data's