N
Noman Ali
Hi,
I am new in using OWC11. I am generating a chart using the C# code below.
The problem is that the second series bars are not shown in chart. I also
want to know how can i get the right percentage as it gives me always 100
percantage.
ChartSpaceClass oChartSpace = new ChartSpaceClass();
string[] aNames = new string["1", "2" , "3"];
string[] aTotals = new string["3", "4", "5"];
string[] aWeightage = new string["10", "11", "12"];
string[] companyTotals = new string["5","6","7"];
tring names = String.Empty;
string totals = String.Empty;
string weightage = String.Empty;
string company = String.Empty;
//Chart control accepts tab-delimited string of values
names = String.Join("\t", aNames);
totals = String.Join("\t", aTotals);
weightage = String.Join("\t", aWeightage);
company = String.Join("\t", companyTotals);
oChartSpace.Charts.Add(0);
oChartSpace.Charts[0].Type =
(ChartChartTypeEnum)((int)Session["ChartType"]);
oChartSpace.Charts[0].SeriesCollection.Add(0);
oChartSpace.Charts[0].SeriesCollection[0].Caption = "Employee Parameters
Average";
oChartSpace.Charts[0].SeriesCollection.Add(1);
oChartSpace.Charts[0].SeriesCollection[1].Caption = "Company Parameters
Average";
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), names);
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), totals);
oChartSpace.Charts[0].SeriesCollection[1].SetData(ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), names);
oChartSpace.Charts[0].SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), companyTotals);
// Display the title for the chart
oChartSpace.Charts[0].HasTitle = true;
oChartSpace.Charts[0].Title.Caption = "Employee OverAll Appraisal";
oChartSpace.Charts[0].Axes[0].HasTitle = true;
oChartSpace.Charts[0].Axes[0].Title.Caption = "Parameter";
oChartSpace.Charts[0].Axes[1].HasTitle = true;
oChartSpace.Charts[0].Axes[1].Title.Caption = "Score";
oChartSpace.Charts[0].Axes[1].Scaling.Minimum = 0;
oChartSpace.Charts[0].Axes[1].Scaling.Maximum = 15;
oChartSpace.Charts[0].HasLegend = true;
for (int i = 0; i <= 3; i++)
{
ChDataLabels a =
oChartSpace.Charts[0].SeriesCollection[0].DataLabelsCollection.Add();
a.HasPercentage = true;
a.HasValue = true;
}
long ticks = DateTime.Now.Ticks;
string strFullPathAndName = Server.MapPath("~/images/graphs/" + userName +
"graph" + ticks + ".gif");
//Server.MapPath(System.DateTime.Now.Ticks.ToString() + ".gif");
oChartSpace.ExportPicture(strFullPathAndName, "gif", 640, 480);
I am new in using OWC11. I am generating a chart using the C# code below.
The problem is that the second series bars are not shown in chart. I also
want to know how can i get the right percentage as it gives me always 100
percantage.
ChartSpaceClass oChartSpace = new ChartSpaceClass();
string[] aNames = new string["1", "2" , "3"];
string[] aTotals = new string["3", "4", "5"];
string[] aWeightage = new string["10", "11", "12"];
string[] companyTotals = new string["5","6","7"];
tring names = String.Empty;
string totals = String.Empty;
string weightage = String.Empty;
string company = String.Empty;
//Chart control accepts tab-delimited string of values
names = String.Join("\t", aNames);
totals = String.Join("\t", aTotals);
weightage = String.Join("\t", aWeightage);
company = String.Join("\t", companyTotals);
oChartSpace.Charts.Add(0);
oChartSpace.Charts[0].Type =
(ChartChartTypeEnum)((int)Session["ChartType"]);
oChartSpace.Charts[0].SeriesCollection.Add(0);
oChartSpace.Charts[0].SeriesCollection[0].Caption = "Employee Parameters
Average";
oChartSpace.Charts[0].SeriesCollection.Add(1);
oChartSpace.Charts[0].SeriesCollection[1].Caption = "Company Parameters
Average";
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), names);
oChartSpace.Charts[0].SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), totals);
oChartSpace.Charts[0].SeriesCollection[1].SetData(ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), names);
oChartSpace.Charts[0].SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), companyTotals);
// Display the title for the chart
oChartSpace.Charts[0].HasTitle = true;
oChartSpace.Charts[0].Title.Caption = "Employee OverAll Appraisal";
oChartSpace.Charts[0].Axes[0].HasTitle = true;
oChartSpace.Charts[0].Axes[0].Title.Caption = "Parameter";
oChartSpace.Charts[0].Axes[1].HasTitle = true;
oChartSpace.Charts[0].Axes[1].Title.Caption = "Score";
oChartSpace.Charts[0].Axes[1].Scaling.Minimum = 0;
oChartSpace.Charts[0].Axes[1].Scaling.Maximum = 15;
oChartSpace.Charts[0].HasLegend = true;
for (int i = 0; i <= 3; i++)
{
ChDataLabels a =
oChartSpace.Charts[0].SeriesCollection[0].DataLabelsCollection.Add();
a.HasPercentage = true;
a.HasValue = true;
}
long ticks = DateTime.Now.Ticks;
string strFullPathAndName = Server.MapPath("~/images/graphs/" + userName +
"graph" + ticks + ".gif");
//Server.MapPath(System.DateTime.Now.Ticks.ToString() + ".gif");
oChartSpace.ExportPicture(strFullPathAndName, "gif", 640, 480);