Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai

I have written code to add a chart control but I am getting error Can you please resolve

this.

C#
ChartControl chart = new ChartControl();
DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series("Series 1", ViewType.Bar);
series1.Points.Add(new SeriesPoint(new DateTime(2009, 1, 1), new double[] { 26.25 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 2, 1), new double[] { 16.52 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 3, 1), new double[] { 22.21 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 4, 1), new double[] { 15.35 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 5, 1), new double[] { 24.15 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 6, 1), new double[] { 26.25 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 7, 1), new double[] { 16.52 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 8, 1), new double[] { 22.21 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 9, 1), new double[] { 15.35 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 10, 1), new double[] { 24.15 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 11, 1), new double[] { 26.25 }));
series1.Points.Add(new SeriesPoint(new DateTime(2009, 12, 1), new double[] { 16.52 }));
chart.Series.Add(series1);

Then I am getting this error

Error	3	The type or namespace name 'ChartControl' could not be found (are you missing a using directive or an assembly reference?

I am following this link

https://documentation.devexpress.com/#WindowsForms/CustomDocument6244[^]
Actually I want to do monthly sales analysis chart by adding Months to the x-axis of the chart and Total Amount to y-axis.For that I have to add database to chart.

Here I am getting only that dates from 01/01/2009 to 01/12/2009 not month names.

Would You Please Suggest me what to do
Posted
Updated 19-Feb-15 22:04pm
v5

The error message says it all. You either add a using[^] directive in the beginning of your class file or another way is to use fully qualified definitions
C#
DevExpress.XtraCharts.ChartControl chart = new DevExpress.XtraCharts.ChartControl();
DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series("Series 1", ViewType.Bar);
series1.Points.Add(new DevExpress.XtraCharts.SeriesPoint(new DateTime(2009, 1, 1), new double[] { 26.25 }));
...
 
Share this answer
 
v2
Comments
TarunKumarSusarapu 20-Feb-15 2:24am    
I have already added using DevExpress.XtraCharts namespace.Still I am getting same error.
Wendelius 20-Feb-15 2:29am    
Have you referenced the proper library? If you're using the newest version I think the correct assembly to add to references is DevExpress.XtraCharts.v14.2.UI.dll
TarunKumarSusarapu 20-Feb-15 3:33am    
Yeah it's working.Thank You For your Information.
Wendelius 20-Feb-15 4:03am    
You're welcome.
TarunKumarSusarapu 20-Feb-15 3:37am    
I want to ask one more question to you how to add database to y points
Add DevExpress.XtraCharts.v14.2.UI as a reference
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900