- Home
- Forum
- ASP.NET Web Forms (Classic)
- webchart control and add series
webchart control and add series
Hi, I am using Syncfusion webchartcontrol version 6.102.0.34 and unable to get the below code working. The code fails on the line _chartSCurve.Series.Add(series1);
The error is "Object reference not set ot an instance of an object.". Please help!! Let me know if you need more information.
_chartSCurve.Model.Series.Clear();
ChartSeries series1 = _chartSCurve.Model.NewSeries(" Server 1");
series1.Text = series1.Name;
series1.Type = ChartSeriesType.Spline;
series1.Points.Add(10, 187);
series1.Points.Add(20, 151);
series1.Points.Add(30, 180);
series1.Points.Add(40, 206);
series1.Points.Add(50, 122);
series1.Points.Add(60, 31);
series1.Points.Add(70, 189);
series1.Points.Add(80, 54);
series1.Points.Add(90, 181);
ChartSeries series2 = _chartSCurve.Model.NewSeries(" Server 2");
series2.Text = series2.Name;
series2.Type = ChartSeriesType.Spline;
series2.Points.Add(10, 256);
series2.Points.Add(20, 451);
series2.Points.Add(30, 382);
series2.Points.Add(40, 437);
series2.Points.Add(50, 321);
series2.Points.Add(60, 234);
series2.Points.Add(70, 425);
series2.Points.Add(80, 257);
series2.Points.Add(90, 382);
_chartSCurve.BeginUpdate();
_chartSCurve.Series.Add(series1);
_chartSCurve.Series.Add(series2);
_chartSCurve.EndUpdate();
SIGN IN To post a reply.
14 Replies
MS
Manimala S
Syncfusion Team
June 8, 2009 09:39 AM UTC
Hi,
Thanks for using Essential chart.
Kindly check your assembly version and your chart control version, and create the instance of the chart series with a "new" keyword.
//Code
ChartSeries cs=new ChartSeries();
I have created a simple chart sample to demonstrate this. Kindly, get the sample from the following location.
Kindly, let me know if it helps.
Thanks,
Manimala.
Thanks for using Essential chart.
Kindly check your assembly version and your chart control version, and create the instance of the chart series with a "new" keyword.
//Code
ChartSeries cs=new ChartSeries();
I have created a simple chart sample to demonstrate this. Kindly, get the sample from the following location.
Kindly, let me know if it helps.
Thanks,
Manimala.
AD
Administrator
Syncfusion Team
June 9, 2009 05:18 PM UTC
Hi Manimala,
The chart version that I am using is 6.102.0.34. Also I tried to create the chart series like you mentioned but it doesn't work. I get the same error when trying to add the chartseries object to my webchart control. Also, looks like you forgot to type in the sample location. Please post it again.
Please help. This is urgent.
Thanks!
The chart version that I am using is 6.102.0.34. Also I tried to create the chart series like you mentioned but it doesn't work. I get the same error when trying to add the chartseries object to my webchart control. Also, looks like you forgot to type in the sample location. Please post it again.
Please help. This is urgent.
Thanks!
MS
Manimala S
Syncfusion Team
June 10, 2009 12:37 PM UTC
Hi,
Thanks for using Syncfusion Products.
The error denotes that a valid chart control reference cannot be found. Kindly, remove all the reference from your application and then add the following references.
Syncfusion.Chart.Base
Syncfusion.Chart.Windows
Syncfusion.Chart.Web
Syncfusion.Core
Syncfusion.Shared.Base
Syncfusion.Tools.Base
and import the following namespaces.
Syncfusion.Windows.Forms.Chart and
Syncfusion.Drawing
Kindly, check the references of all the assemblies and all has to be of same version.
Kindly, let me know if it works.
Thanks,
Manimala.
Thanks for using Syncfusion Products.
The error denotes that a valid chart control reference cannot be found. Kindly, remove all the reference from your application and then add the following references.
Syncfusion.Chart.Base
Syncfusion.Chart.Windows
Syncfusion.Chart.Web
Syncfusion.Core
Syncfusion.Shared.Base
Syncfusion.Tools.Base
and import the following namespaces.
Syncfusion.Windows.Forms.Chart and
Syncfusion.Drawing
Kindly, check the references of all the assemblies and all has to be of same version.
Kindly, let me know if it works.
Thanks,
Manimala.
AD
Administrator
Syncfusion Team
June 10, 2009 03:46 PM UTC
Hi Manimala,
I tried your suggestion and still get the same error. Any other ideas?
Thanks much.
I tried your suggestion and still get the same error. Any other ideas?
Thanks much.
MS
Manimala S
Syncfusion Team
June 11, 2009 12:17 PM UTC
Hi,
Sorry for the inconvenience.
Can you please submit the query through your Direct Trac account, so that your issue will be solved quickly by our engineers.
Kindly, let me know if you have any other queries.
Thanks,
Manimala.
Sorry for the inconvenience.
Can you please submit the query through your Direct Trac account, so that your issue will be solved quickly by our engineers.
Kindly, let me know if you have any other queries.
Thanks,
Manimala.
AD
Administrator
Syncfusion Team
June 11, 2009 12:59 PM UTC
Hi,
I tried to create a direct trac incident but I get "File not found" error, when I click on open new incident.
I need to resolve this issue asap. Your quick response is appreciated.
Thanks!
MS
Manimala S
Syncfusion Team
June 17, 2009 09:28 AM UTC
Hi,
Thanks for posting it in Direct Trac. I was not able to reproduce the issue. I have created a simple sample. Kindly, get the sample from the following link.
http://files.syncfusion.com/support/Chart.Web/6.1.0.34/I56911/main.htm
Can you please send me a sample reproducing this issue, so that I can analyze more deeply.
We apologize for any inconvenience.
Thanks,
Manimala.
Thanks for posting it in Direct Trac. I was not able to reproduce the issue. I have created a simple sample. Kindly, get the sample from the following link.
http://files.syncfusion.com/support/Chart.Web/6.1.0.34/I56911/main.htm
Can you please send me a sample reproducing this issue, so that I can analyze more deeply.
We apologize for any inconvenience.
Thanks,
Manimala.
RD
Ramaa Davanagere
June 23, 2009 07:40 AM UTC
Hi Manimala,
Below is my code. I'm only sending sections of my code that contains syncfusion chart control code. Please go thro' it and let me know what is not correct. Thanks for your help.
ASPX page
---------
<%@ Page Language="C#" MasterPageFile="~/CIP/CIPMaster.Master" AutoEventWireup="true" CodeBehind="SpendPlan.aspx.cs" Inherits="PCUMD.WebUI.Projects.SpendPlan" Title="PCUMD-CIP-Spend Plan" %>
<%@ Register Assembly="Syncfusion.Shared.Web, Version=6.102.0.34, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"
Namespace="Syncfusion.Web.UI.WebControls.Shared" TagPrefix="ssw" %>
<%@ Register TagPrefix="DBWC" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="Syncfusion.Chart.Web, Version=6.102.0.34, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"
Namespace="Syncfusion.Web.UI.WebControls.Chart" TagPrefix="syncfusion" %>
Font-Size="14pt" BorderColor="Black" Font-Names="Arial Narrow" CalcRegions="True" BorderStyle="Solid" style="left: 0px; top: 0px" ClientObjectId="Chart1"> |
My chartcontrol "_chartSCurve" is embedded inside a popup control called "ssw:WaitingPopup"
Code Behind
-----------
protected void _btnViewSCurve_Click(object sender, EventArgs e)
{
ChartSeries series1 = new ChartSeries();
series1.Name = "Server 1 Name";
series1.Text = "Server1 text";
series1.Type = ChartSeriesType.Spline;
series1.Points.Add(10, 187);
series1.Points.Add(20, 151);
series1.Points.Add(30, 180);
series1.Points.Add(40, 206);
series1.Points.Add(50, 122);
series1.Points.Add(60, 31);
series1.Points.Add(70, 189);
series1.Points.Add(80, 54);
series1.Points.Add(90, 181);
ChartSeries series2 = new ChartSeries();
series2.Name = "Server 2 Name";
series2.Text = "Server 2 Text";
series2.Type = ChartSeriesType.Spline;
series2.Points.Add(10, 256);
series2.Points.Add(20, 451);
series2.Points.Add(30, 382);
series2.Points.Add(40, 437);
series2.Points.Add(50, 321);
series2.Points.Add(60, 234);
series2.Points.Add(70, 425);
series2.Points.Add(80, 257);
series2.Points.Add(90, 382);
_chartSCurve.BeginUpdate();
_chartSCurve.Series.Add(series1);
_chartSCurve.Series.Add(series2);
_chartSCurve.EndUpdate();
}
RD
Ramaa Davanagere
June 23, 2009 08:37 AM UTC
Hi Manimala,
I was finally able to figure out what the problem was. The BeginUpdate() should be done for the chart series rather than the chart object itself. The following code works flawlessly.
_chartSCurve.Series.BeginUpdate();
_chartSCurve.Series.Add(series1);
_chartSCurve.Series.EndUpdate();
Thanks for your help anyway.
I was finally able to figure out what the problem was. The BeginUpdate() should be done for the chart series rather than the chart object itself. The following code works flawlessly.
_chartSCurve.Series.BeginUpdate();
_chartSCurve.Series.Add(series1);
_chartSCurve.Series.EndUpdate();
Thanks for your help anyway.
RD
Ramaa Davanagere
June 23, 2009 05:37 PM UTC
Hi Manimala,
I need some more help in generating the attached chart. I now have the "Add series" part taken care off. I need help with the following.
1. How do is set the chart background color?
2. How do I set the chart area background color?
3. How do I make the x-axis gradients as 1 2 3 4 etc rather than 0 2 4 5?
4. I only want to show the horizontal grid lines in the chart area and not the vertical lines. How do I do this?
5. I am currently using a spline chart with the border style set to dashdot. However, this is not the same as the one in the attached sample. Do syncfusion support something that is shown in the attached sample? If so, please let me kmow the setting.
Thanks a lot for your help.
chart_d068ff14.bmp
MS
Manimala S
Syncfusion Team
June 24, 2009 09:27 AM UTC
Hi,
Thanks for the update.
And here are the answers for your questions:
1) How do is set the chart background color?
We have a property called BackInterior to do this.
//Code
this.ChartWebControl1.BackInterior = new BrushInfo(Color.AliceBlue);
2) We have BackInterior property of the chartarea to do this
//Code
this.ChartWebControl1.ChartArea.BackInterior = new BrushInfo(Color.AliceBlue);
3) How do I make the x-axis gradients as 1 2 3 4 etc rather than 0 2 4 5?
We can set the range of the axis to get this.
//Code
this.ChartWebControl1.PrimaryXAxis.Range = new MinMaxInfo(1, 8, 1);
4) I only want to show the horizontal grid lines in the chart area and not the vertical lines. How do I do this?
We can do this by setting DrawGrid property of the axis to false.
//Code
this.ChartWebControl1.PrimaryXAxis.DrawGrid = false;
I have created a sample to satisfy your requirement. Kindly, get the sample from the following location.
Sample File
Kindly, let me know if your requirement is satisfied.
Thanks,
Manimala.
Thanks for the update.
And here are the answers for your questions:
1) How do is set the chart background color?
We have a property called BackInterior to do this.
//Code
this.ChartWebControl1.BackInterior = new BrushInfo(Color.AliceBlue);
2) We have BackInterior property of the chartarea to do this
//Code
this.ChartWebControl1.ChartArea.BackInterior = new BrushInfo(Color.AliceBlue);
3) How do I make the x-axis gradients as 1 2 3 4 etc rather than 0 2 4 5?
We can set the range of the axis to get this.
//Code
this.ChartWebControl1.PrimaryXAxis.Range = new MinMaxInfo(1, 8, 1);
4) I only want to show the horizontal grid lines in the chart area and not the vertical lines. How do I do this?
We can do this by setting DrawGrid property of the axis to false.
//Code
this.ChartWebControl1.PrimaryXAxis.DrawGrid = false;
I have created a sample to satisfy your requirement. Kindly, get the sample from the following location.
Sample File
Kindly, let me know if your requirement is satisfied.
Thanks,
Manimala.
RD
Ramaa Davanagere
June 25, 2009 12:01 AM UTC
Hi Manimala,
Thank you so much for the sample code. I need one minor change in it though. Instead of showing 1, 2,3,4 etc as x-axis labels, I want to show custom labels like "FY08 Q1",
"FY08 Q2", "FY08 Q3", etc and show them in a 45 degree angle. Below is the code I'm using to display these labels. The problem is they are not showing in an angle. Can you pinpoint what I'm doing wrong? Thanks much
_chartSCurve.ChartArea.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Clear();
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY10 Q1", Color.Blue, new Font("Monospace", 7), 1, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY09 Q4", Color.Blue, new Font("Monospace", 7), 2, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY09 Q3", Color.Blue, new Font("Monospace", 7), 3, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY09 Q2", Color.Blue, new Font("Monospace", 7), 4, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY09 Q1", Color.Blue, new Font("Monospace", 7), 5, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY08 Q4", Color.Blue, new Font("Monospace", 7), 6, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY08 Q3", Color.Blue, new Font("Monospace", 7), 7, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.Labels.Add(new ChartAxisLabel("FY08 Q2", Color.Blue, new Font("Monospace", 7), 8, "", ChartValueType.Custom));
_chartSCurve.ChartArea.PrimaryXAxis.TickSize = new Size(3, 3);
_chartSCurve.ChartArea.PrimaryXAxis.LabelRotateAngle = 45;
_chartSCurve.ChartArea.PrimaryXAxis.LabelRotate = true;
_chartSCurve.ChartArea.PrimaryXAxis.Inversed = true;
_chartSCurve.ChartArea.PrimaryXAxis.LabelAligment = StringAlignment.Far;
_chartSCurve.ChartArea.HidePartialLabels = true;
_chartSCurve.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
MS
Manimala S
Syncfusion Team
June 25, 2009 01:00 PM UTC
Hi,
Thanks for your continuous support.
Can you please post your queries in Direct Trac. You have already created an incident for this particular issue, so can you please post further queries also through Direct Trac so that the priority to get the solution would be more compared to forums.
Thanks,
Manimala.
Thanks for your continuous support.
Can you please post your queries in Direct Trac. You have already created an incident for this particular issue, so can you please post further queries also through Direct Trac so that the priority to get the solution would be more compared to forums.
Thanks,
Manimala.
RD
Ramaa Davanagere
June 25, 2009 01:46 PM UTC
Hi Manimala,
Unfortunately, at this time, we don't have an active support license and our company doesn't have any immediate plans of renewing it and hence I can't post my question in direct trac.
Your help is appreciated.
Thanks
SIGN IN To post a reply.
- 14 Replies
- 3 Participants
-
AD Administrator
- Jun 4, 2009 03:55 PM UTC
- Jun 25, 2009 01:46 PM UTC