private Chart BuildChart2() { string reportName = "rptCurrentStatusSummary"; var data = new BoundChartData { ChartType = SeriesChartType.Pie, Title = "Pie", xValueMember = "JobStatus", yValueMembers = new string[] {"JobCount"}, DataSource = GetReportData(reportName), pointUrl = POINT_URL_HEAD + string.Format(POINT_URL_TAIL, "JobStatus") }; return BindChartData(data); }
private Chart BuildChart1() { /* var data = new RawChartData { ChartType = SeriesChartType.Column, Title = "Column", Data = new string[] { "A", "B", "C", "D" }, xValues = new string[] { "A", "B", "C", "D" }, yValues = new decimal[] { 1, 2, 3, 4 } }; */ string reportName = "rptDueDateOutcomes"; var data = new BoundChartData { ChartType = SeriesChartType.Column, Title = "Column", xValueMember = "DateLabel", yValueMembers = new string[] {"AvgTargetVsAchieved", "CompleteCount"}, DataSource = GetReportData(reportName), pointUrl = POINT_URL_HEAD + string.Format(POINT_URL_TAIL, "Date") }; return BindChartData(data); }
private Chart BindChartData(BoundChartData data) { Chart chart = new Chart(); chart.Width = CHART_WIDTH; chart.Height = CHART_HEIGHT; chart.Attributes.Add("align", "left"); chart.Titles.Add(data.Title); // Display a Title chart.ChartAreas.Add(new ChartArea()); chart.Legends.Add(new Legend("Legend")); chart.Legends[0].TableStyle = LegendTableStyle.Auto; chart.Legends[0].Docking = Docking.Bottom; for (int index = 0; index < data.yValueMembers.Length; index++) { chart.Series.Add(new Series()); chart.Series[index].XValueMember = data.xValueMember; chart.Series[index].YValueMembers = data.yValueMembers[index]; chart.Series[index].ChartType = data.ChartType; // SeriesChartType.Pie, SeriesChartType.Bar chart.Series[index].BackGradientStyle = GradientStyle.DiagonalLeft; chart.Series[index].BackSecondaryColor = System.Drawing.Color.LightGray; } chart.Series[0].Legend = chart.Legends[0].Name; switch (data.ChartType) { case SeriesChartType.Pie: { chart.Series[0]["PieLabelStyle"] = "Inside"; chart.Series[0]["PieLabelStyle"] = "Disabled"; chart.Series[0]["PieLineColor"] = "Black"; chart.Series[0]["PieDrawingStyle"] = "Concave"; break; } } chart.DataSource = data.DataSource; chart.DataBind(); foreach (DataPoint pt in chart.Series[0].Points) { string pointId = !string.IsNullOrEmpty(pt.AxisLabel) ? pt.AxisLabel : (pt.XValue + "," + pt.YValues); pt.Url = data.pointUrl + pointId; pt.ToolTip = "Drilldown"; pt.LegendText = "#VALX: #VALY"; pt.LegendUrl = data.legendUrl + pointId; pt.LegendToolTip = "Click to view " + pointId + "'information..."; } return chart; }
private Chart BuildChart5() { string reportName = "rptUserWorkload"; var data = new BoundChartData { ChartType = SeriesChartType.Doughnut, Title = "Doughnut", xValueMember = "UserID", yValueMembers = new string[] {"JobCount"}, DataSource = GetReportData(reportName), pointUrl = POINT_URL_HEAD + string.Format(POINT_URL_TAIL, "UserID") }; return BindChartData(data); }
private Chart BuildChart4() { /* var data = new RawChartData { ChartType = SeriesChartType.Bar, Title = "Bar", Data = new string[] { "A", "B", "C", "D" }, xValues = new string[] { "A", "B", "C", "D" }, yValues = new decimal[] { 1, 2, 3, 4 } }; */ string reportName = "rptJobsInJeopardy"; var data = new BoundChartData { ChartType = SeriesChartType.Bar, Title = "Bar", xValueMember = "DateLabel", yValueMembers = new string[] {"JeopardyCount"}, DataSource = GetReportData(reportName), pointUrl = POINT_URL_HEAD + string.Format(POINT_URL_TAIL, "Date") }; return BindChartData(data); }
private Chart BuildChart3() { /* var data = new RawChartData { ChartType = SeriesChartType.Line, Title = "Line", Data = new string[] { "A", "B", "C", "D" }, xValues = new string[] { "A", "B", "C", "D" }, yValues = new decimal[] { 1, 2, 3, 4 } }; */ string reportName = "rptTimeToCompletion"; var data = new BoundChartData { ChartType = SeriesChartType.Line, Title = "Line", xValueMember = "DateLabel", yValueMembers = new string[] {"AvgTimeToCompletion"}, DataSource = GetReportData(reportName), pointUrl = POINT_URL_HEAD + string.Format(POINT_URL_TAIL, "Date") }; return BindChartData(data); }