Hi, is it possible to convert a dynamic chart in static chart and viceversa? I tried changing dynamic property from true to false but the xAxis keeps containing a limited number of items…
Many thanks in advance
Here’s a snippet:
var data = [];
for (var i=0; i<=200; i++)
data.push({ time: i+1,
sales: Math.round(Math.random()*5000+2000),
sales2: Math.round(Math.random()*5000+2000)*0.5
});
var chart = {
view:"chart",
id:"dchart",
type:"spline",
value:"#sales#",
xAxis:{ template:"#time#" },
yAxis:{},
width: 300,
dynamic: true,
series:[
{
value:"#sales#",
item:{
borderColor: "#1293f8",
color: "#ffffff"
},
line:{
color:"#1293f8",
width:3
},
tooltip:{
template:"#sales#"
}
},
{
value:"#sales2#",
item:{
borderColor: "#66cc00",
color: "#ffffff"
},
line:{
color:"#66cc00",
width:3
},
tooltip:{
template:"#sales2#"
}
}
],
item:{
borderColor: "#1293f8",
color: "#ffffff"
}
};
var range = {
view:"rangechart", height: 80, id:"range",
type:"line",
padding:0,
series:[
{
value:"#sales#",
item:{ radius: 0 },
line:{
color:"#1293f8",
width:1
}
},
{
value:"#sales2#",
item:{ radius: 0 },
line:{
color:"#66cc00",
width:1
}
}
],
frameId:"time",
item: { radius :0 },
data: data,
on: {
onAfterRangeChange:function(){
$$("dchart").define("dynamic",false);
$$("dchart").refresh();
$$("dchart").clearAll();
$$("dchart").parse(this.getFrameData());
}
},
ready:function(){
this.setFrameRange({start:30, end:40});
}
};
webix.ui({
//container:"chartDiv", type:"wide",
rows:[
chart,
range
]
});