This is a migrated thread and some comments may be shown as answers.

Bound Chart not showing.

3 Answers 86 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 14 May 2014, 01:47 AM
This is my first time using HtmlChart and I need a bit of help.

I have bound a grid and chart on the server side. The grid works but the chart doesn't.

Here is the code and attached is a screen capture what I currently getting and what I would like to see.

ASP.NET
                        <td width="100%" valign="top" align="left">
                            <telerik:RadHtmlChart ID="barChart" runat="server" Width="600px" Height="200px">
                            </telerik:RadHtmlChart>
                        </td>

C#
                DataTable dtNetworkCompareResults = dataSet.Tables["NetworkCompareResults"];

                radgridSearchResults.DataSource = dtNetworkCompareResults;
                radgridSearchResults.Visible = true;
                radgridSearchResults.DataBind();

                barChart.DataSource = dtNetworkCompareResults;

                this.barChart.PlotArea.Series.Clear();

                LineSeries networkSeries1 = new LineSeries { DataFieldY = "Total" };
                this.barChart.PlotArea.Series.Add(networkSeries1);
                LineSeries networkSeries2 = new LineSeries { DataFieldY = "PSC" };
                this.barChart.PlotArea.Series.Add(networkSeries2);
                LineSeries networkSeries3 = new LineSeries { DataFieldY = "Specialist"};
                this.barChart.PlotArea.Series.Add(networkSeries3);

                barChart.PlotArea.XAxis.DataLabelsField = "NetworkName";
                barChart.PlotArea.XAxis.Name = "NetworkName";

                barChart.Legend.Appearance.Visible = true;
                barChart.Visible = true;

                barChart.DataSource = dtNetworkCompareResults;
                barChart.DataBind();

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 May 2014, 09:32 AM
Hi Eric,

Please have a look into this online demo for creating a chart Pro-grammatically .

Thanks,
Princy.
0
Eric
Top achievements
Rank 1
answered on 14 May 2014, 11:21 AM
Princy, Thanks for you quick reply. Nevertheless I had already looked at the example you suggested and many others. 

Can you please point out what might be missing from the code I posted?

Thanks,

Eric Bechtinger
0
Princy
Top achievements
Rank 2
answered on 15 May 2014, 05:43 AM
Hi Eric,

Please have a look into this help article which describes how the items of RadHtmlChart can be created using different approaches like Declarative,Data Binding, Programmatic Creation and Declarative & Programmatic Creation.

Please provide your full code if it doesn't help you.
Thanks,
Princy.
Tags
Chart (HTML5)
Asked by
Eric
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Eric
Top achievements
Rank 1
Share this question
or