I am trying to implement editable textbox ( solution in either chartjs or fusion charts is fine). Tried a bit in fusioncharts capturing user click event on a data point using trigger. Check the jsfiddle from fusionchart example here... [dataPlotClick
]1event. However, the goal is to show an external text box as modal form or something else, record user comments and then store them in mysql database. Finally, update tooltip with new comments to re-load chart data. Any inputs are helpful. Below is what I have.
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js?cacheBust=56"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: 'msline',
renderAt: 'chart-container',
width: '500',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"paletteColors": "#0075c2,#1aaf5d",
"bgcolor": "#ffffff",
"showBorder": "0",
"showShadow": "0",
"showCanvasBorder": "0",
"usePlotGradientColor": "0",
"legendBorderAlpha": "0",
"legendShadow": "0",
"showAxisLines": "0",
"showAlternateHGridColor": "0",
"divlineThickness": "1",
"divLineIsDashed": "1",
"divLineDashLen": "1",
"divLineGapLen": "1",
"xAxisName": "Day",
"showValues": "0"
},
"categories": [{
"category": [{
"label": "1"
}, {
"label": "2"
}, {
"label": "3"
}, {
"label": "4"
}]
}],
"dataset": [{
"seriesname": "Bakersfield Central",
"data": [{
"value": "30",
"toolText" : 'this value is 30'
}, {
"value": "25",
"toolText" : 'below expectation',
}, {
"value": "30",
"toolText" : 'this value expected'
}, {
"value": "35",
"toolText" : 'exceeds'
}]
}],
"trendlines": [{
"line": [{
"startvalue": "30",
"color": "#6baa01",
"valueOnRight": "1",
"displayvalue": "Average"
}]
}]},
"events": {
"dataPlotClick": function (eventObj, dataObj) {
console.log(dataObj);
var data_index = dataObj['dataIndex'];
var tool_text = dataObj['toolText'];
alert(data_index);
alert(tool_text);
}
}
}).render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>