How to position excel chart using c# - c#

I am developing a excel chart programmatically using c# and excel interop dll.
I develop this kind of chart. here is the screen shot
But i want chart like..(New Chart)
Here i am giving my full code. please see to it and guide me what extra code i need to make new chart.
Excel Data..
Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart;
Excel.Range chartRange;
Excel.Chart chartPage;
myChart = (Excel.ChartObject)xlCharts.Add(630, 20, 300, 250);
chartRange = xlWorkSheet.Range["AW2", "BA5"];
chartPage = myChart.Chart;
chartPage.Legend.Delete();
myChart.Height = 380;
myChart.Width = 565;
myChart.Chart.HasDataTable = true;
myChart.Chart.DataTable.Font.Size = 10;
myChart.Chart.DataTable.Font.Name = "+Body";
chartPage.SetSourceData(chartRange, misValue);
chartPage.ChartType = Excel.XlChartType.xlLineMarkers;

I solved problem. Now just add some lines of code in above given code. Call this function chart_series_design(chartPage, "", ""); at the end. Function is like
public void chart_series_design(Excel.Chart chartPage,string xmsg,string ymsg)
{
chartPage.set_HasAxis(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary, true);
chartPage.set_HasAxis(Excel.XlAxisType.xlSeriesAxis, Excel.XlAxisGroup.xlSecondary, true);
chartPage.set_HasAxis(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlSecondary, true);
chartPage.set_HasAxis(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary, true);
chartPage.set_HasAxis(Excel.XlAxisType.xlSeriesAxis, Excel.XlAxisGroup.xlPrimary, true);
chartPage.set_HasAxis(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary, true);
Excel.Series series = (Excel.Series)chartPage.SeriesCollection(1);
series.AxisGroup = Excel.XlAxisGroup.xlSecondary;
series.AxisGroup = Excel.XlAxisGroup.xlPrimary;
series.Format.Line.Weight = 1.0F;
series.Format.Line.Visible = MsoTriState.msoFalse; //Tri-State
series.Format.Line.ForeColor.RGB = (int)Microsoft.Office.Interop.Excel.XlRgbColor.rgbWhite;
series = (Excel.Series)chartPage.SeriesCollection(2);
series.AxisGroup = Excel.XlAxisGroup.xlSecondary;
series.AxisGroup = Excel.XlAxisGroup.xlPrimary;
series.Format.Line.Weight = 1.0F;
series.Format.Line.Visible = MsoTriState.msoFalse; //Tri-State
series.Format.Line.ForeColor.RGB = (int)Microsoft.Office.Interop.Excel.XlRgbColor.rgbWhite;
series = (Excel.Series)chartPage.SeriesCollection(3);
series.AxisGroup = Excel.XlAxisGroup.xlSecondary;
series.AxisGroup = Excel.XlAxisGroup.xlPrimary;
series.Format.Line.Weight = 1.0F;
series.Format.Line.Visible = MsoTriState.msoFalse; //Tri-State
series.Format.Line.ForeColor.RGB = (int)Microsoft.Office.Interop.Excel.XlRgbColor.rgbWhite;
series = (Excel.Series)chartPage.SeriesCollection(4);
series.AxisGroup = Excel.XlAxisGroup.xlSecondary;
series.AxisGroup = Excel.XlAxisGroup.xlPrimary;
series.Format.Line.Weight = 1.0F;
series.Format.Line.Visible = MsoTriState.msoFalse; //Tri-State
series.Format.Line.ForeColor.RGB = (int)Microsoft.Office.Interop.Excel.XlRgbColor.rgbWhite;
Excel.Axis axis;
axis = (Excel.Axis)chartPage.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary);
axis.HasTitle = true;
axis.AxisTitle.Text = xmsg;
axis = (Excel.Axis)chartPage.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);
axis.HasTitle = true;
axis.AxisTitle.Text = ymsg;
}

Related

I have very similar charts in my c# form app (10-20). How can I program this charts with one method where I can pass the chart name as variable?

I have very similar charts in my c# form app (10-20) (Chart1,Chart2,Chart3.....). The only difference of the charts are the data series. Normally I have to repeat the same code 10–20 times in my project.
How can I program the charts with one method, that I can call multiple times, when I can pass the chart name as a variable. I have searched a lot but found really no solution for that.
My code for one chart is as following:
public void Draw_Chart()
{
chart1.Series.Clear();
chart1.Titles.Clear();
chart1.Legends.Clear();
var newSeries_1 = new Series();
var newSeries_2 = new Series();
newSeries_1.ChartType = SeriesChartType.Line;
newSeries_2.ChartType = SeriesChartType.Line;
chart1.Series.Add(newSeries_1);
chart1.Series.Add(newSeries_2);
List_X_Axis.Clear();
for (int w = 0 ; w <= 940; w++)
{
parameter_value_chartX[w] = w;
//parameter_value_chartY1[w] = 150;
//parameter_value_chartY1[w] = 250;
}
newSeries_1.Points.DataBindXY(parameter_value_chartX, parameter_value_chartY1);
newSeries_2.Points.DataBindXY(parameter_value_chartX, parameter_value_chartY2);
chart1.BackColor = Color.Gray;
chart1.ChartAreas[0].AxisX.Title = ".";
chart1.ChartAreas[0].AxisY.Title = "mm";
chart1.ChartAreas[0].AxisY.TitleForeColor = Color.Cyan;
chart1.ChartAreas[0].AxisY.LabelStyle.ForeColor = Color.Cyan;
chart1.ChartAreas[0].AxisX.Minimum = 0d;
chart1.Series[0].Color = Color.Cyan;
chart1.ChartAreas[0].AxisY.Minimum = cur_scale_min;
chart1.ChartAreas[0].AxisY.Maximum = cur_scale_max;
chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True;
chart1.ChartAreas[0].AxisY2.Minimum = pos_scale_min;
chart1.ChartAreas[0].AxisY2.Maximum = pos_scale_max;
chart1.ChartAreas[0].AxisY2.Title = "% of Max. Current";
chart1.ChartAreas[0].AxisY2.TitleForeColor = Color.Yellow;
chart1.ChartAreas[0].AxisY2.LabelStyle.ForeColor = Color.Yellow;
chart1.ChartAreas[0].AxisY2.MajorGrid.LineColor = Color.Silver;
chart1.ChartAreas[0].AxisY2.MajorTickMark.LineColor = Color.Silver;
chart1.Series[1].YAxisType = AxisType.Secondary;
chart1.Series[1].Color = Color.Yellow;
}
public void Draw_Chart(Chart chart, Series[] series)
{
...
chart.Series.Clear();
series.ForEach(s=>chart.Series.Add(s));
...
}
I found the solution acc. to Ralf's comment in the following way:
...
Draw_Chart(chart1);
...
Draw_Chart(chart2);
...
Draw_Chart(chart3);
...
public void Draw_Chart(Chart chart)
{
chart.Series.Clear();
chart.Titles.Clear();
chart.Legends.Clear();
var newSeries_1 = new Series();
var newSeries_2 = new Series();
newSeries_1.ChartType = SeriesChartType.Line;
newSeries_2.ChartType = SeriesChartType.Line;
chart.Series.Add(newSeries_1);
chart.Series.Add(newSeries_2);
...
}

c# excel interop charts

I have a question: how to remove the displaying of zeros and percents?
chart
And second question: if I have only zeros then the diagram is empty. Is there any method to fill the chart with the inscription? For example, "no data".
chart2
#region 123
Excel.ChartObjects xlChart1 = (Excel.ChartObjects)WorkSheet_2.ChartObjects(Type.Missing);
Excel.ChartObject myxlChart1 = (Excel.ChartObject)xlChart1.Add(600, 1110, 450, 450);
Excel.Chart chartpage1 = myxlChart1.Chart;
Excel.SeriesCollection col = chartpage1.SeriesCollection();
chartpage1.ChartType = Excel.XlChartType.xlPie;
chartpage1.ChartArea.Border.Color = Color.FromArgb(30, 82, 255).ToArgb();
Excel.SeriesCollection chartpage1seriesCollection = chartpage1.SeriesCollection();
SeriesCollection seriesCollection3ddef = (SeriesCollection)chartpage1.SeriesCollection(Type.Missing);
Series series1= seriesCollection3ddef.NewSeries();
series1.XValues = WorkSheet_2.get_Range("BF3", "BM3");
series1.Values = WorkSheet_2.get_Range("BF15", "BM15");
Excel.Axis myaxis = chartpage1.Axes(Excel.XlAxisType.xlValue, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary) as Excel.Axis;
series1.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabel, false, Type.Missing, false, false, false, true, Excel.XlDataLabelsType.xlDataLabelsShowPercent, false, "\n");
series1.DataLabels().Font.Name = "Arial";
series1.DataLabels().Font.Size = 12;
series1.DataLabels().Orientation = 0;
chartpage1.HasLegend = true;
chartpage1.Legend.Border.Color = ColorTranslator.ToOle(Color.DarkRed);
chartpage1.Legend.Position = XlLegendPosition.xlLegendPositionCorner;
chartpage1.Legend.Font.Name = "Arial";
chartpage1.Legend.Font.Size = 10;
;
chartpage1.HasTitle = true;
chartpage1.ChartTitle.Text = "MyChart, \n N, pcs";
chartpage1.ChartTitle.Position = XlChartElementPosition.xlChartElementPositionAutomatic;
chartpage1.ChartTitle.Font.Size = 14;
chartpage1.ChartTitle.Font.Name = "Arial";
chartpage1.ChartTitle.Font.Bold = true;
x3l.PlotArea(chartpage1, ChartHeight * 0.30, ChartWidth * 0.06, ChartHeight * 0.8, ChartWidth * 0.8);
#endregion
Thanks!

Make YAxis match ticks in Microsoft.Chart

I am sure there is a way to do this. I have been looking for a while an just haven't found out. I have major and minor ticks defined in my chart but the values on the LH side of the Y Axis does not match the lines (every 20) in the chart. How can I make the values match the lines?
EDIT
Here are the lines of code that creates the values. These were created in Designer through editing the ChartAreas collection.
chartArea1.AxisX.MajorGrid.Interval = 20D;
chartArea1.AxisX.MajorTickMark.Interval = 10D;
chartArea1.AxisX.Maximum = 50D;
chartArea1.AxisX.Minimum = 0D;
chartArea1.AxisX2.Maximum = 50D;
chartArea1.AxisX2.Minimum = 0D;
chartArea1.AxisY.MajorGrid.Interval = 20D;
chartArea1.AxisY.Maximum = 420D;
chartArea1.AxisY.Minimum = 300D;
chartArea1.AxisY.MinorGrid.Interval = 10D;
chartArea1.AxisY2.Maximum = 420D;
chartArea1.AxisY2.Minimum = 300D;
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chart1.Legends.Add(legend1);
this.chart1.Location = new System.Drawing.Point(12, 27);
this.chart1.Name = "chart1";
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series1.IsValueShownAsLabel = true;
series1.Legend = "Legend1";
series1.Name = "TempHistory";
series2.ChartArea = "ChartArea1";
series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series2.Legend = "Legend1";
series2.Name = "LowerLimit";
series3.ChartArea = "ChartArea1";
series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series3.Legend = "Legend1";
series3.Name = "UpperLimit";
this.chart1.Series.Add(series1);
this.chart1.Series.Add(series2);
this.chart1.Series.Add(series3);
this.chart1.Size = new System.Drawing.Size(1326, 186);
this.chart1.TabIndex = 53;
this.chart1.Text = "chart1";
chartArea1.AxisY.Interval needs to equal chartArea1.AxisX.MajorGrid.Interval

visifire Custom Axis Labels Not Showing

I need to Export my Chart as an image without showing it first in WPF. So i built the Chart in Code:
public void CreateHistogram(CalcRepository cr, int i)
{
Chart chart = new Chart();
chart.Width = 300;
chart.Height = 200;
chart.ScrollingEnabled = false;
chart.AnimationEnabled = false;
chart.TrendLines.Add(new TrendLine{Value = cr.Mean,Orientation = System.Windows.Controls.Orientation.Vertical});
chart.TrendLines.Add(new TrendLine{Value = cr.ChartTrippleNegativeStdDeviation,Orientation = System.Windows.Controls.Orientation.Vertical,LineStyle = LineStyles.Dashed});chart.TrendLines.Add(new TrendLine{Value = cr.ChartTripplePositiveStdDeviation,Orientation = System.Windows.Controls.Orientation.Vertical,LineStyle = LineStyles.Dashed});
chart.TrendLines.Add(new TrendLine{Value = cr.UpperSpecificationLimit,Orientation = System.Windows.Controls.Orientation.Vertical});
chart.TrendLines.Add(new TrendLine{Value = cr.LowerSpecificationLimit,Orientation = System.Windows.Controls.Orientation.Vertical});
chart.TrendLines[0].SetValue(Canvas.ZIndexProperty, 40);
chart.TrendLines[1].SetValue(Canvas.ZIndexProperty, 40);
chart.TrendLines[2].SetValue(Canvas.ZIndexProperty, 40);
chart.TrendLines[3].SetValue(Canvas.ZIndexProperty, 40);
chart.TrendLines[4].SetValue(Canvas.ZIndexProperty, 40);
chart.DataPointWidth = cr.DataPointWidth;
chart.Visibility = Visibility.Visible;
Axis x = new Axis();
x.AxisMaximum = cr.VisUpperBound;
x.AxisMinimum = cr.VisLowerBound;
x.AxisType = AxisTypes.Primary;
CustomAxisLabels cal = new CustomAxisLabels();
cal.Labels.Add(new CustomAxisLabel {From = cr.Mean, To = cr.Mean, Text = "Mean"});
cal.Labels.Add(new CustomAxisLabel {From = cr.ChartTrippleNegativeStdDeviation,To = cr.ChartTrippleNegativeStdDeviation,Text = "LCL"});
cal.Labels.Add(new CustomAxisLabel{From = cr.ChartTripplePositiveStdDeviation,To = cr.ChartTripplePositiveStdDeviation,Text= "UCL"});
cal.Labels.Add(new CustomAxisLabel {From = cr.UpperSpecificationLimit, To = cr.UpperSpecificationLimit , Text = "USL"});
cal.Labels.Add(new CustomAxisLabel {From = cr.LowerSpecificationLimit, To = cr.LowerSpecificationLimit, Text = "LSL"});
cal.FontSize = 10;
cal.Angle = 0;
cal.FontColor = new SolidColorBrush(Colors.Black);
cal.Enabled = true;
x.CustomAxisLabels.Add(cal);
chart.AxesX.Add(x);
var ds = new DataSeries();
var dpc = new DataPointCollection(cr.HistogramValues);
ds.DataPoints = dpc;
chart.Series.Add(ds);
ds.ZIndex = 1;
ds.Bevel = false;
ds.ShadowEnabled = false;
ds.LightingEnabled = false;
ds.Color = new SolidColorBrush(Colors.SteelBlue);
chart.BeginInit();
chart.EndInit();
chart.Measure(new Size(300, 200));
chart.Arrange(new Rect(0, 0, 300, 200));
chart.UpdateLayout();
ExportToPng(new Uri("C:\\" + i + ".png"), chart);
}
everything works fine, except the custom Axis Labels are missing. This is how the Output looks like:
As you can see, there is even space allocated for the CustomAxis Labels but they are not shown. Anyone got an idea?
Hint: AnimationEnabled has to be set false otherwise the series is not rendered yet when the image is taken - took me a long time to figure that out.
I found already a solution:
When exceeding the bounds, the values are set to Double.NaN. I found out, that the creation of all Labels fails, if any value in the Collections Double.Nan or Double.Infinity - Seems lika a bug in visifire.
I solved it by adding each Label in its seperate Collection.

Microsoft Chart, bar graph

I'm trying to make a bar graph, which have to show a bar graph of quality of some goods. My question is about how to make it happen. I'm not sure that the chart control can handle the criterias I want done.
If you imagine that you have a default product, and you want the quality of the barcode. The quality is describe from A(highest) to F(lowest). The output on the graph should be as followed.
http://billedeupload.dk/upload/files/2011-11/f4e132dd.jpg
The understanding of the graph is that it's showing you the quality of the barcode in as a whole, and individually as for example the quality "A". You can see how good the quality of "A" are, compared to the whole.
Can you do this i visual studio c#? And how?
Im using a winform! ;)
Edited:
I want to make it as a Stacked Bargraph. <-- answer to my own question.
Anybody who have a code example for newbies to coding?
Thanks!
The project is old, but I think the source code will help.
WpfSimpleChart
http://wpfsimplechart.codeplex.com/
You should refine your question yet, whether you want to do wpf or winforms.
EDIT
After refining the question, here is a cool charting lib for winforms.
ZedGraph
A flexible charting library for .NET
http://www.codeproject.com/KB/graphics/zedgraph.aspx
I am just getting back into MSChart, so I'll share my findings in hopes that it helps you (and you will check my answer as the correct answer)
I am using LINQPad (http://www.linqpad.net/) to learn MSChart. It is the fastest tool to write C# and render images. I was using Visual Studio, but it takes too much time to build the solution so I can see the results of my changes. I am 'hacking' at MSChart, so I needed faster responses.
I was following the tutorial at http://msdn.microsoft.com/en-us/library/dd489237.aspx to create my LINQPad C# program.
I hope this helps. You could just take my createChart function and drop it in your WinForms project. Take a look at the drawIt method, that is what brings together the stream into an actual graphic.
FYI,
I am using SysDraw = System.Drawing
SysDraw.Color blueStart = SysDraw.Color.FromArgb(124,195,215);
SysDraw.Color blueEnd = SysDraw.Color.FromArgb(74,166,192);
SysDraw.Color grayStart = SysDraw.Color.FromArgb(153,153,153);
SysDraw.Color grayEnd = SysDraw.Color.FromArgb(208,210,211);
SysDraw.Color orangeStart = SysDraw.Color.FromArgb(252,165,107);
SysDraw.Color orangeEnd = SysDraw.Color.FromArgb(255,104,4);
void Main()
{
//chart1 is from Microsoft's sample site
// other charts are using http://msdn.microsoft.com/en-us/library/dd489237.aspx
Chart chart1 = createChart1();
Chart chart2= createChart2(42, "Chart 2");
Chart chart3 = createChart2(99, "Chart 3");
Chart chart4 = createChart2(11, "Chart 4");
drawIt(chart2, chart2.Name);
drawIt(chart3, chart3.Name);
drawIt(chart4, chart4.Name);
drawIt(chart1, chart1.Name);
}
private void drawIt(Chart drawChart, string name)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
drawChart.SaveImage(ms,SysDraw.Imaging.ImageFormat.Png);
SysDraw.Bitmap outImage = new SysDraw.Bitmap(ms);
outImage.Dump(name);
}
private void drawIt(string imageFilePath)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
SysDraw.Bitmap outImage = new SysDraw.Bitmap(imageFilePath);
outImage.Dump(imageFilePath);
}
private Chart createChart2(double dataPointYvalue, string chartName)
{
string chartAreaName ="Area 1";
// Chart
// --------------------------------
Chart results = new Chart();
results.Name = chartName;
results.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
results.BorderSkin.SkinStyle = BorderSkinStyle.None;
SysDraw.Size size1 = new SysDraw.Size(480,30);
results.Size = size1;
// ChartAreas collection
// --------------------------------
ChartArea area1 =new ChartArea(chartAreaName);
area1.Area3DStyle.Enable3D=false;
//area1.Area3DStyle.Enable3D=true;
area1.Area3DStyle.WallWidth=10;
//area1.Area3DStyle.Inclination=10;
//area1.Area3DStyle.Perspective = 10;
area1.Area3DStyle.Rotation=1;
//area1.BorderDashStyle = ChartDashStyle.DashDot;
area1.BackGradientStyle = GradientStyle.TopBottom;
area1.BackColor = grayStart;
area1.BackSecondaryColor = grayEnd;
// Axes under Area collection
Axis axisX = new Axis();
axisX.LabelStyle.Interval = 1;
axisX.Title ="x axis";
axisX.IsMarginVisible=false;
axisX.Enabled = AxisEnabled.False;
Axis axisY = new Axis();
axisY.Title = "y axis";
axisY.IsMarginVisible=true;
axisY.Enabled = AxisEnabled.False;
area1.AxisX = axisX;
area1.AxisY = axisY;
results.ChartAreas.Add(area1);
// Series Collection Editor
// --------------------------------
Series series1 = new Series("Series 1");
series1.ChartArea = chartAreaName;
series1.ChartType = SeriesChartType.Bar;
series1.CustomProperties="DrawingStyle=Cylinder";
series1.Name = "BarChart";
series1.BackGradientStyle = GradientStyle.TopBottom;
series1.Color=blueStart;
series1.BackSecondaryColor = blueEnd;
// series1.BorderDashStyle= ChartDashStyle.DashDotDot;
// series1.BorderColor = SysDraw.Color.Red;
//series1.Points.AddY(42);
DataPoint dp = new DataPoint();
dp.Name="MyPoint";
dp.YValues= new double[]{dataPointYvalue};
series1.Points.Add(dp);
results.Series.Add(series1);
// Legend
// --------------------------------
// Legend legend = new Legend("Chart 2 Legend");
// legend.DockedToChartArea = "Chart 2 Area 1";
// legend.Docking = Docking.Right;
// legend.IsDockedInsideChartArea = true;
// results.Legends.Add(legend);
// series1.Legend = "Chart 2 Legend"; //You can assign each series to a different legend.
// Title
// --------------------------------
Title title = new Title(string.Format("Your whatever is {0}",dp.YValues[0]));
title.Docking = Docking.Right;
title.TextOrientation = TextOrientation.Horizontal;
//title.DockedToChartArea = chartAreaName;
//results.Titles.Add(title);
// Annotations
// --------------------------------
ArrowAnnotation arrowAnnt = new ArrowAnnotation();
arrowAnnt.AnchorDataPoint=dp;
arrowAnnt.Height=-5;
arrowAnnt.Width=0;
arrowAnnt.AnchorOffsetY=-2.5;
arrowAnnt.SmartLabelStyle.IsOverlappedHidden = false;
TextAnnotation textAnnt = new TextAnnotation();
textAnnt.AnchorDataPoint = dp;
textAnnt.AnchorOffsetX = -10;
textAnnt.ForeColor=SysDraw.Color.White;
textAnnt.Text = dp.YValues[0].ToString();
//results.Annotations.Add(arrowAnnt);
results.Annotations.Add(textAnnt);
return results;
}
private Chart createChart1()
{
Title title1 = new Title();
ChartArea chartArea1 = new ChartArea();
Legend legend1 = new Legend();
Series series1 = new Series();
DataPoint dataPoint1 = new DataPoint(0, 6);
DataPoint dataPoint2 = new DataPoint(0, 9);
DataPoint dataPoint3 = new DataPoint(0, 5);
DataPoint dataPoint4 = new DataPoint(0, 7.5);
DataPoint dataPoint5 = new DataPoint(0, 5.6999998092651367);
DataPoint dataPoint6 = new DataPoint(0, 7);
DataPoint dataPoint7 = new DataPoint(0, 8.5);
Series series2 = new Series();
DataPoint dataPoint8 = new DataPoint(0, 6);
DataPoint dataPoint9 = new DataPoint(0, 9);
DataPoint dataPoint10 = new DataPoint(0, 2);
DataPoint dataPoint11 = new DataPoint(0, 7);
DataPoint dataPoint12 = new DataPoint(0, 3);
DataPoint dataPoint13 = new DataPoint(0, 5);
DataPoint dataPoint14 = new DataPoint(0, 8);
Series series3 = new Series();
DataPoint dataPoint15 = new DataPoint(0, 4);
DataPoint dataPoint16 = new DataPoint(0, 2);
DataPoint dataPoint17 = new DataPoint(0, 1);
DataPoint dataPoint18 = new DataPoint(0, 3);
DataPoint dataPoint19 = new DataPoint(0, 2);
DataPoint dataPoint20 = new DataPoint(0, 3);
DataPoint dataPoint21 = new DataPoint(0, 5);
Chart results = new Chart();
//((System.ComponentModel.ISupportInitialize)(results)).BeginInit();
//
// resulting chart
//
results.BackColor = System.Drawing.Color.WhiteSmoke;
results.BackGradientStyle = GradientStyle.TopBottom;
results.BackSecondaryColor = System.Drawing.Color.White;
results.BorderlineColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
results.BorderlineDashStyle = ChartDashStyle.Solid;
results.BorderlineWidth = 2;
results.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
chartArea1.Area3DStyle.Enable3D = true;
chartArea1.Area3DStyle.Inclination = 15;
chartArea1.Area3DStyle.IsClustered = false;
chartArea1.Area3DStyle.IsRightAngleAxes = false;
chartArea1.Area3DStyle.PointGapDepth = 0;
chartArea1.Area3DStyle.Rotation = 10;
chartArea1.Area3DStyle.WallWidth = 0;
chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisX.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.BackColor = System.Drawing.Color.WhiteSmoke;
chartArea1.BackSecondaryColor = System.Drawing.Color.White;
chartArea1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.Name = "Default";
chartArea1.ShadowColor = System.Drawing.Color.Transparent;
results.ChartAreas.Add(chartArea1);
results.Cursor = System.Windows.Forms.Cursors.Hand;
legend1.BackColor = System.Drawing.Color.Transparent;
legend1.Enabled = false;
legend1.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
legend1.IsTextAutoFit = false;
legend1.Name = "Default";
results.Legends.Add(legend1);
results.Location = new System.Drawing.Point(16, 53);
results.Name = "chart1";
series1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
series1.ChartArea = "Default";
series1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(65)))), ((int)(((byte)(140)))), ((int)(((byte)(240)))));
series1.Legend = "Default";
series1.Name = "Default";
series1.Points.Add(dataPoint1);
// series1.Points.Add(dataPoint2);
// series1.Points.Add(dataPoint3);
// series1.Points.Add(dataPoint4);
// series1.Points.Add(dataPoint5);
// series1.Points.Add(dataPoint6);
// series1.Points.Add(dataPoint7);
// series2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
// series2.ChartArea = "Default";
// series2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(252)))), ((int)(((byte)(180)))), ((int)(((byte)(65)))));
// series2.Legend = "Default";
// series2.Name = "Series2";
// series2.Points.Add(dataPoint8);
// series2.Points.Add(dataPoint9);
// series2.Points.Add(dataPoint10);
// series2.Points.Add(dataPoint11);
// series2.Points.Add(dataPoint12);
// series2.Points.Add(dataPoint13);
// series2.Points.Add(dataPoint14);
// series3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
// series3.ChartArea = "Default";
// series3.Color = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(224)))), ((int)(((byte)(64)))), ((int)(((byte)(10)))));
// series3.Legend = "Default";
// series3.Name = "Series3";
// series3.Points.Add(dataPoint15);
// series3.Points.Add(dataPoint16);
// series3.Points.Add(dataPoint17);
// series3.Points.Add(dataPoint18);
// series3.Points.Add(dataPoint19);
// series3.Points.Add(dataPoint20);
// series3.Points.Add(dataPoint21);
results.Series.Add(series1);
// results.Series.Add(series2);
// results.Series.Add(series3);
results.Size = new System.Drawing.Size(412, 296);
results.TabIndex = 1;
title1.Font = new System.Drawing.Font("Trebuchet MS", 14.25F, System.Drawing.FontStyle.Bold);
title1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
title1.Name = "Title1";
title1.ShadowColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
title1.ShadowOffset = 3;
title1.Text = "3D Cylinder";
results.Titles.Add(title1);
SysDraw.Size mySize = new SysDraw.Size(480, 170);
results.Size = mySize;
return results;
}

Categories

Resources