- Home
- Forum
- ASP.NET MVC (Classic)
- Cannot add series to chart
Cannot add series to chart
Hi,
How can I add series?
<%@ Register assembly="Syncfusion.EJ.Web, Version=14.1460.0.46, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Web" tagprefix="ej" %>
<%@ Register Assembly="Syncfusion.EJ, Version=14.1460.0.46, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Models" TagPrefix="ej" %>
<ej:Chart ID="ChartByHour" runat="server" SeriesType="Column" EnableViewState="False" IsResponsive="true" CanResize="true" Height="300">
<Legend Position="Right" EnableScrollbar="false"></Legend>
<PrimaryYAxis>
<Range Min="0" Interval="1" />
</PrimaryYAxis>
<PrimaryXAxis>
<Range Interval="1" />
</PrimaryXAxis>
<Series>
??? can't add series ???
</Series>
</ej:Chart>
Thanks,
Tomer
SIGN IN To post a reply.
3 Replies
DD
Dharanidharan Dharmasivam
Syncfusion Team
July 24, 2017 12:24 PM UTC
Hi Tomer,
Thanks for contacting Syncfusion support.
We have analyzed your query. From the provided code snippet, we suspect that you are using ASP.NET platform. So, we have prepared a sample in ASP.NET platform with two series with respect to the provided code snippet. Here you need to specify the x and y values in string format. You can change this with respect to your scenario.
|
ASP.NET:
<ej:Chart ID="ChartByHour">
<Series>
<ej:Series>
<Points>
<ej:Points X="1" Y="2"></ej:Points>
<ej:Points X="2" Y="2"></ej:Points>
<ej:Points X="3" Y="9"></ej:Points>
<ej:Points X="4" Y="7"></ej:Points>
<ej:Points X="5" Y="6"></ej:Points>
</Points>
</ej:Series>
<ej:Series>
<Points>
<ej:Points X="1" Y="4"></ej:Points>
<ej:Points X="2" Y="8"></ej:Points>
<ej:Points X="3" Y="3"></ej:Points>
<ej:Points X="4" Y="9"></ej:Points>
<ej:Points X="5" Y="4"></ej:Points>
</Points>
</ej:Series>
</ej:Chart>
|
Screenshot:
Also, if you need to bind data source from code behind, you can directly bind the data list to the data source as depicted below and then you can map to the data to respective series using XName and YName of series property. Find the code snippet below to achieve this requirement.
|
<ej:Chart ID="Chart1">
<Series>
<ej:Series XName="Xvalue" YName="YValue1"> </ej:Series>
//...
</Series>
</ej:Chart>c
Controller Page:
List<LineChartData> data = new List<LineChartData>();
data.Add(new LineChartData(2005, 28, 31, 36, 39));
data.Add(new LineChartData(2006, 25, 28, 32, 36));
//...
//Binding Datasource to Chart1
this.Chart1.DataSource = data;
this.Chart1.DataBind();
|
For more information on data binding, find the help document.
Sample for reference can be find from below link.
Kindly revert us, if you have any concern.
Thanks,
Dharani.
TO
tomer
July 25, 2017 10:36 AM UTC
Hi,
After I copy/paste your code into my web page, I got several exceptions like
Unknown server tag 'ej:Series' and Unknown server tag 'ej:Points'. and
Element 'Series' is not a known element and Element 'Points' is not a known element
I solved the issue by adding this line:
<%@ Register Assembly="Syncfusion.EJ, Version=14.1460.0.46, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.DataVisualization.Models" TagPrefix="ej" %>
Thank you very much !
Tomer
DD
Dharanidharan Dharmasivam
Syncfusion Team
July 26, 2017 05:52 AM UTC
Hi Tomer,
Thanks for your update. Yes you need to add the assembly reference in order to render the chart.
Kindly revert us, if you have any concern.
Thanks,
Dharani.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TO tomer
- Jul 23, 2017 03:02 PM UTC
- Jul 26, 2017 05:52 AM UTC