L
Luis
I have a windows app with one form and a reference to Microsoft Office
Chart 11.0
The form has that control in it and one button. The code is below.
The chart displays, but not the series.
Thanks,
Luis
private void button1_Click(object sender, System.EventArgs e)
{
try
{
ChChart oChart;
axChartSpace1.Clear() ;
oChart = axChartSpace1.Charts.Add(0) ;
string[] chartCategoriesArr = new string []
{"10", "20", "30", "40", "50"};
string[] chartValuesArr = new string []
{"9", "5", "7", "13", "19"};
string chartCategoriesStr = String.Join ("\t", chartCategoriesArr);
string chartValuesStr = String.Join ("\t", chartValuesArr) ;
Debug.WriteLine (chartCategoriesStr.ToString() );
Debug.WriteLine (chartValuesStr.ToString() );
Debug.WriteLine ("Axes.Count" + oChart.Axes.Count.ToString() );
//oChart.Type = ChartChartTypeEnum.chChartTypeColumn3D;
oChart.Type = ChartChartTypeEnum.chChartTypeSmoothLine ;
ChSeries oSeries;
oSeries = oChart.SeriesCollection.Add(0) ;
//oChart.Border.Color = "white";
//oChart.HasTitle = true;
//oChart.ChartDepth = 125;
//oChart.AspectRatio = 80;
//oChart.Title.Caption = "Pricing Of 2004 Hondas";
//oChart.Title.Font.Bold = true;
oSeries.SetData( ChartDimensionsEnum.chDimCategories,
Convert.ToInt32( ChartSpecialDataSourcesEnum.chDataLiteral ),
chartCategoriesArr);
oSeries.SetData( ChartDimensionsEnum.chDimValues ,
Convert.ToInt32( ChartSpecialDataSourcesEnum.chDataLiteral
),chartValuesArr);
oSeries.Name = "Luis";
oSeries.Caption ="Caption Luis";
//ChDataLables Label;
oSeries.DataLabelsCollection.Add ();
//oSeries.DataLabelsCollection.Add ("lable2");
//oSeries.DataLabelsCollection.Add ("lable3");
axChartSpace1.Refresh();
}
catch (Exception ex)
{
Debug.WriteLine("Error");
Console.WriteLine(ex.Message);
Debug.WriteLine(ex.Source);
Debug.Unindent();
}
}
Chart 11.0
The form has that control in it and one button. The code is below.
The chart displays, but not the series.
Thanks,
Luis
private void button1_Click(object sender, System.EventArgs e)
{
try
{
ChChart oChart;
axChartSpace1.Clear() ;
oChart = axChartSpace1.Charts.Add(0) ;
string[] chartCategoriesArr = new string []
{"10", "20", "30", "40", "50"};
string[] chartValuesArr = new string []
{"9", "5", "7", "13", "19"};
string chartCategoriesStr = String.Join ("\t", chartCategoriesArr);
string chartValuesStr = String.Join ("\t", chartValuesArr) ;
Debug.WriteLine (chartCategoriesStr.ToString() );
Debug.WriteLine (chartValuesStr.ToString() );
Debug.WriteLine ("Axes.Count" + oChart.Axes.Count.ToString() );
//oChart.Type = ChartChartTypeEnum.chChartTypeColumn3D;
oChart.Type = ChartChartTypeEnum.chChartTypeSmoothLine ;
ChSeries oSeries;
oSeries = oChart.SeriesCollection.Add(0) ;
//oChart.Border.Color = "white";
//oChart.HasTitle = true;
//oChart.ChartDepth = 125;
//oChart.AspectRatio = 80;
//oChart.Title.Caption = "Pricing Of 2004 Hondas";
//oChart.Title.Font.Bold = true;
oSeries.SetData( ChartDimensionsEnum.chDimCategories,
Convert.ToInt32( ChartSpecialDataSourcesEnum.chDataLiteral ),
chartCategoriesArr);
oSeries.SetData( ChartDimensionsEnum.chDimValues ,
Convert.ToInt32( ChartSpecialDataSourcesEnum.chDataLiteral
),chartValuesArr);
oSeries.Name = "Luis";
oSeries.Caption ="Caption Luis";
//ChDataLables Label;
oSeries.DataLabelsCollection.Add ();
//oSeries.DataLabelsCollection.Add ("lable2");
//oSeries.DataLabelsCollection.Add ("lable3");
axChartSpace1.Refresh();
}
catch (Exception ex)
{
Debug.WriteLine("Error");
Console.WriteLine(ex.Message);
Debug.WriteLine(ex.Source);
Debug.Unindent();
}
}