I am trying to plot multiple line Charts in Apache Zeppelin using Angular Js and Chart JS. i am binding an array in the Scala Paragraph in the format {epoch, id, label, score, tweet_count}. The objective is for every id, there will be a different set of values. on running the code i am having two different graphs (on hovering mouse). i would like to have 1 graph. For instance, for id 1,2 i would like to plot a score graph in the same canvas and not want it overlapped.
angular.forEach(newValue, function(x) {
lineChartData = {}; //declare an object
lineChartData.labels = []; //add 'labels' element to object (X axis)
lineChartData.datasets = []; //add 'datasets' array element to object
for(line=0; line < 2; line++) {
y = [];
lineChartData.datasets.push({}); //create a new line dataset
dataset = lineChartData.datasets[line]
dataset.data = []; //Y axis data
angular.forEach(newValue, function(x) {
if(myLineChart != null && myLineChart !== undefined)
myLineChart.destroy();
if (line === 0 ) {
// console.log("Value of x: ",x)
//adds data to y axis
lineChartData.labels.push(x._3) //adds x axis labels
dataset.fillColor = "rgba(0, 0, 0, 0)";
dataset.strokeColor = "rgba(75,192,192,0.4)";
dataset.lineColor = "rgba(75,192,192,0.4)";
dataset.label = "Score"
y.push(x._4); //y axis value
}
lineChartData.datasets[line].data = y;
})
}
})
This is my code which plots the graph, but i would like to plot different lines for each id in the same canvas.