Html Chart
Set the categoryAxis property of the jqxChart.
Author: http://jqwidgets.com
HTML
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<div id='jqxChart' style="width:530px; height:400px; position: relative; left: 0px; top: 0px;"></div>
<button id='btnUpdate'>update</button>
JavaScript
var sampleData = [{
a: 1,
x: 50
}, {
a: 1,
x: 60
}, {
a: 10,
x: 70
}, {
a: 100,
x: 80
}];
var settings = {
source: sampleData,
xAxis: {
type:'linear',
dataField: 'a',
showGridLines: true,
showTickMarks: true,
formatFunction: function (value, index) {
return index;
},
rangeSelector:{
size: 60,
dataField: 'a',
gridLines: { visible: true },
serieType: 'line'
}
},
seriesGroups: [
{
type: 'line',
series: [
{ dataField: 'a', displayText: 'A', emptyPointsDisplay: 'connect' },
{ dataField: 'x', displayText: 'X', emptyPointsDisplay: 'connect' }
]
}
]
};
$('#jqxChart').jqxChart(settings);
var chart= $('#jqxChart' ).jqxChart('getInstance');
$('#btnUpdate').click(function () {
var sampleData1 = [
{
a: 110,
x: 150
},{
a: 120,
x: 260
}
];
chart.source = sampleData1;
chart._selectorRange=[];
chart.update();
});