I've tried setting up a Telerik RadHTMLChart following this setup (including specifying XAxis/YAxis, Series, etc), and I've used this Telerik documentation (including allowing the chart to define its own params, see markup below) to try to set the data source dynamically, but I can't get the chart to display.
When a button is click, it removes a class that does display: none;
on the div wrapping the graph, then calls the generateGraph()
function:
this.generateGraph = function () {
var newData = [];
for (var i = 0; i < 10; i++) {
var newPoint = {
"Value": 2 * i,
"Color": "Green"
}
newData.push(newPoint);
}
radGraph.set_dataSource(newData);
radGraph.repaint();
}
but there are a couple strange things happening:
- The graph doesn't show unless, using the Chrome console source, I put a breakpoint over
radGraph.repaint()
and manually run theradGraph.repaint()
command. - After doing so, no data points show up.
- The times I have gotten some values to show up (I can't even remember how), the multiple points were connected by a line, as if in the same series.
Can someone help me out? I'm using the Telerik.Web.UI.dll version 2015.2.623.40.
This is the markup:
<telerik:RadHtmlChart ID="radGraphChart" ClientIDMode="Static" runat="server">
<PlotArea>
<Series>
<telerik:LineSeries DataFieldY="Value" ColorField="Color" >
</telerik:LineSeries>
</Series>
</PlotArea>
</telerik:RadHtmlChart>
EDIT: I've figured out the #1 and #2 issues (#1 is likely a mistake in the kendo code, it's _loadData()
function has if(!u._isStockChart()){u._chartObject.refresh();}}else{u._chartObject.refresh();}
which should have one of the refresh()
calls be redraw()
, I'm pretty sure ... #2 is I made a typo somewhere), but I still don't know how to add multiple series' to the chart.