Column chart from Dynamic text file - CanvasJS JavaScript Charts
Column chart from Dynamic text file - CanvasJS JavaScript Charts
HTML
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<input type="file" id="input">
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
<div id="chartContainer1" style="height: 260px; width: 60%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
theme: "theme2",
title: {
text: "Live Chart from Text File"
},
/*data: [
{
type: "column",
dataPoints: []
}
]*/
data: [
{
type: "line",
showInLegend: true,
dataPoints: []
},
{
type: "line",
showInLegend: true,
dataPoints: []
},
{
type: "line",
showInLegend: true,
dataPoints: []
}
]
,
legend:{
cursor:"pointer",
itemclick : function(e) {
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
}
else {
e.dataSeries.visible = true;
}
chart.render();
}
}
});
var chart1 = new CanvasJS.Chart("chartContainer1", {
theme: "theme2",
animationEnabled: true,
animationDuration: 1500,
backgroundColor: "transparent",
title: {
text: "event display",
fontColor:"white"
},
legend: {
verticalAlign: "top",
horizontalAlign: "center",
fontSize: 300,
fontColor: "red",
fontWeight: "bold",
fontFamily: "calibri",
},
axisX: {
title: "RR @ 1 sec"
},
axisY:{
prefix: ' ',
includeZero: true
},
/*data: [
{
type: "column",
dataPoints: []
}
]*/
data: [
{
type: "column",
showInLegend: true,
dataPoints: []
},
{
type: "column",
showInLegend: true,
dataPoints: []
},
{
type: "line",
showInLegend: true,
dataPoints: []
}],
legend:{
cursor:"pointer",
itemclick : function(e) {
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
}
else {
e.dataSeries.visible = true;
}
...