private void BindChart(Chart chart , DataTable dt , string titleName , System.Web.UI.WebControls.Label lbl) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 480 , 300 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = DundasCharts.CreateSeries(chart , "Series1" , "Default" , null , null , SeriesChartType.Doughnut , 1 , GetChartColor(0) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; //series1.ShowLabelAsValue = true; //series1.ShowInLegend = true; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points[i].AxisLabel = dt.Rows[i]["ALIAS"].ToString(); //} //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points.AddY(dt.Rows[i]["RESULT_TS"]); //} DataTable dtData = DataTypeUtility.FilterSortDataTable(dt, "KPI_REF_ID > 0"); for (int i = 0; i < dtData.Rows.Count; i++) { series1.Points.AddXY(dt.Rows[i]["TEXT"].ToString(), dt.Rows[i]["RESULT_TS"]); } if (series1.Type == SeriesChartType.Pie || series1.Type == SeriesChartType.Doughnut) { for (int p = 0; p < series1.Points.Count; p++) { DataPoint point = series1.Points[p]; point.Color = GetChartColor(p); } } //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); series1.Font = new Font("굴림", 8, FontStyle.Regular); series1["PieLabelStyle"] = "Outside"; legend.LegendStyle = LegendStyle.Table; legend.AutoFitText = false; legend.Docking = LegendDocking.Bottom; //legend.Alignment = StringAlignment.Near; //legend.Position = new ElementPosition(60, 7, 50, 24); //legend.Enabled = false; //legend.DockInsideChartArea = true; //chart.ChartAreas["Default"].AlignOrientation = AreaAlignOrientation.Horizontal; DundasCharts.SetChartArea(chart.ChartAreas["Default"], true); DataRow[] drCol = dt.Select(string.Format("KPI_REF_ID < 0")); if (drCol.Length > 0) { lbl.Text = DataTypeUtility.GetToDouble(drCol[0]["RESULT_TS"]).ToString("#,##0"); } else { lbl.Text = "0"; } }
private void BindColumnChart(Chart chart , DataSet ds , string titleName , string name , string value) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 240 , 180 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series = null; for (int k = 0; k < ds.Tables.Count; k++) { DataTable dt = ds.Tables[k]; series = DundasCharts.CreateSeries(chart , "Series" + k.ToString() , "Default" , dt.TableName.Replace("사업부", "").Replace("법인", "") , dt.TableName.Replace("사업부", "").Replace("법인", "") , SeriesChartType.Column , 1 , GetChartColor(k) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; series.ToolTip = "#VALY{N0}"; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series, 0.5, 1.5, true); //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points[i].AxisLabel = dt.Rows[i]["ALIAS"].ToString(); //} //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points.AddY(dt.Rows[i]["RESULT_TS"]); //} series.Font = new Font("굴림", 7, FontStyle.Regular); if (k == 0) { //series.Points.AddXY("매출액", dt.Rows[0]["MS_SALES"]); //series.Points.AddXY("영업이익", dt.Rows[0]["MS_PROFIT"]); series.Points.AddXY(name, dt.Rows[0][value]); } else { //series.Points.AddY(dt.Rows[0]["MS_SALES"]); //series.Points.AddY(dt.Rows[0]["MS_PROFIT"]); series.Points.AddY(dt.Rows[0][value]); } } //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); legend.AutoFitText = false; legend.Position = new ElementPosition(73, 7, 50, 40); legend.Font = new Font("굴림", 7, FontStyle.Regular); //legend.LegendStyle = LegendStyle.Table; //legend.AutoFitText = true; //legend.Docking = LegendDocking.Bottom; //legend.LegendStyle = LegendStyle.Table; //legend.AutoFitText = false; ////legend.Position = new ElementPosition(20, 100, 200, 40); //legend.Font = new Font("굴림", 7, FontStyle.Regular); //legend.Docking = LegendDocking.Bottom; DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); }
private void BindChart_ts(Chart chart , DataTable dt , DataTable dt1 , DataTable dt2 , DataTable dt3 , string titleName) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 240 , 160 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = DundasCharts.CreateSeries(chart , "Series1" , "Default" , "목표" , null , SeriesChartType.RangeColumn , 1 , GetChartColor(0) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); Series series2 = DundasCharts.CreateSeries(chart , "Series2" , "Default" , "실적" , null , SeriesChartType.RangeColumn , 1 , GetChartColor(1) , Color.FromArgb(0xD7, 0x41, 0x01) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); Series series3 = DundasCharts.CreateSeries(chart , "Series3" , "Default" , "전년동기" , null , SeriesChartType.RangeColumn , 1 , GetChartColor(2) , Color.FromArgb(107, 148, 49) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; //series2.Label = "#VALY{N0}"; //series3.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; series2.ToolTip = "#VALY{N0}"; series3.ToolTip = "#VALY{N0}"; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); DundasAnimations.GrowingAnimation(chart, series2, 0.5, 1.5, true); DundasAnimations.GrowingAnimation(chart, series3, 0.5, 1.5, true); for (int i = 0; i < dt1.Rows.Count; i++) { series1.Points.AddXY(" ", dt1.Rows[i]["VAL"]); } for (int i = 0; i < dt2.Rows.Count; i++) { series2.Points.AddXY(" ", dt2.Rows[i]["VAL"]); } for (int i = 0; i < dt3.Rows.Count; i++) { series3.Points.AddXY(" ", dt3.Rows[i]["VAL"]); } //series1.ValueMemberX = "NAME"; //series1.ValueMembersY = "VAL"; //series2.ValueMemberX = "NAME"; //series2.ValueMembersY = "VAL"; //chart.DataSource = dt1; //chart.DataBind(); //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points[i].AxisLabel = xValues[i].ToString(); //} //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Font font1 = new Font("Gulim", 10, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); //legend.AutoFitText = true; //legend.Position = new ElementPosition(60, 7, 50, 24); legend.AutoFitText = false; legend.Position = new ElementPosition(70, 2, 50, 25); legend.Font = new Font("굴림", 7, FontStyle.Regular); DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); }
private void BindRangeColumnChart(Chart chart , string query , BiasType biasType , ChartImageType chartImageType) { //DundasCharts.DundasChartBase(chart // , chartImageType // , 800 // , 400 // , BorderSkinStyle.Emboss // , Color.FromArgb(181, 64, 1) // , 2 // , Color.FromArgb(0xFF, 0xFF, 0xFE) // , Color.FromArgb(0xFF, 0xFF, 0xFE) // , Color.FromArgb(0x20, 0x80, 0xD0) // , ChartDashStyle.Solid // , -1 // , ChartHatchStyle.None // , GradientType.TopBottom // , AntiAliasing.None); Biz_DundasCharts.DundasChartBase(chart , chartImageType , 800 , 400 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); //Series series1 = DundasCharts.CreateSeries(chart // , "Series1" // , "Default" // , "최대.최소값" // , null // , SeriesChartType.RangeColumn // , 1 // , Color.FromArgb(0x5A, 0x7D, 0xDE) // , Color.FromArgb(0x4A, 0x58, 0x7E) // , Color.FromArgb(64, 0, 0, 0) // , 1 // , 9 // , Color.FromArgb(64, 64, 64)); Series series1 = Biz_DundasCharts.CreateSeries(chart , "Series1" , "Default" , "최대.최소값" , null , SeriesChartType.RangeColumn , 1 , Color.FromArgb(0x5A, 0x7D, 0xDE) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //Series series2 = DundasCharts.CreateSeries(chart // , "Series2" // , "Default" // , "평균값" // , null // , SeriesChartType.Line // , 3 // , Color.FromArgb(0xFF, 0x8A, 0x00) // , Color.FromArgb(0xD7, 0x41, 0x01) // , Color.FromArgb(64, 0, 0, 0) // , 1 // , 9 // , Color.FromArgb(64, 64, 64)); Series series2 = Biz_DundasCharts.CreateSeries(chart , "Series2" , "Default" , "평균값" , null , SeriesChartType.Line , 3 , Color.FromArgb(0xFF, 0x8A, 0x00) , Color.FromArgb(0xD7, 0x41, 0x01) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.ToolTip = "#VALY{#,##0,00}"; series2.ToolTip = "#VALY{#,##0}"; ArrayList yValues1; ArrayList yValues2; ArrayList yValues3; ArrayList xValues; Biz_DundasCharts.SetDataFieldsX1(query , "EST_EMP_NAME" , out xValues , "PNT_MAX" , out yValues1 , "PNT_MIN" , out yValues2 , "PNT_AVG" , out yValues3); series1.Points.DataBindY(yValues2, yValues1); series2.Points.DataBindY(yValues3, "PNT_AVG"); for (int i = 0; i < xValues.Count; i++) { series1.Points[i].AxisLabel = xValues[i].ToString(); } if (chartImageType == ChartImageType.Flash) { DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 5); DundasAnimations.GrowingAnimation(chart, series1, 0.0, 3.0, false); DundasAnimations.GrowingAnimation(chart, series2, 3.0, 6.0, true); } series2.MarkerStyle = MarkerStyle.Circle; series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); string titleStr = ""; if (biasType == BiasType.ORG) { titleStr = "원시 점수"; } else if (biasType == BiasType.AVG) { titleStr = "평균조정 점수"; } else if (biasType == BiasType.STD) { titleStr = "평균편차조정 점수"; } Font font = new Font("Gulim", 13, FontStyle.Regular); Font font1 = new Font("Gulim", 9, FontStyle.Regular); Dundas.Charting.WebControl.Title title = Biz_DundasCharts.CreateTitle(chart , "Title1" , titleStr , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 5 , 91 , 6); Legend legend = Biz_DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); Biz_DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); }
private void BindChart(Chart chart , DataTable dtItem , DataTable dtStock , DataTable dtData , string titleName) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 480 , 310 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = null; for (int k = 0; k < dtStock.Rows.Count; k++) { DataRow drS = dtStock.Rows[k]; series1 = DundasCharts.CreateSeries(chart , "Series" + k.ToString() , "Default" , drS["S_NAME"].ToString() , null , SeriesChartType.StackedColumn , 1 , GetChartColor(k) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; //series1.ShowLabelAsValue = true; //series1.ShowInLegend = true; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); series1.Font = new Font("굴림", 7, FontStyle.Regular); //for(int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points.AddXY(dt.Rows[i]["ALIAS"].ToString(), dt.Rows[i]["TARGET_TS"]); //} //for(int i = 0; i < dt.Rows.Count; i++) //{ // series2.Points.AddY(dt.Rows[i]["RESULT_TS"]); //} DataTable dtData_1 = DataTypeUtility.FilterSortDataTable(dtData, string.Format("KPI_REF_ID > 0 AND STOCK_CODE = '{0}'", drS["S_ID"])); foreach (DataRow dr in dtData_1.Rows) { if (k == 0) { series1.Points.AddXY(dr["I_NAME"].ToString(), dr["RESULT_TS"]); } else { series1.Points.AddY(dr["RESULT_TS"]); } } //else //{ // series1.Points.AddY(dtData.Rows[k]["RESULT_TS"]); // //series1.Points.AddY(dtData.Rows[k]["RESULT_TS"]); //} } //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); }
private void BindChart(Chart chart , DataTable dt , string titleName) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 480 , 160 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = DundasCharts.CreateSeries(chart , "Series1" , "Default" , "당월미수금(누계)" , null , SeriesChartType.Column , 1 , GetChartColor(0) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); Series series2 = DundasCharts.CreateSeries(chart , "Series2" , "Default" , "당월수금금액" , null , SeriesChartType.Column , 1 , GetChartColor(1) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; series2.ToolTip = "#VALY{N0}"; //series1.ShowLabelAsValue = true; //series1.ShowInLegend = true; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); DundasAnimations.GrowingAnimation(chart, series2, 0.5, 1.5, true); series1.Font = new Font("굴림", 7, FontStyle.Regular); series2.Font = new Font("굴림", 7, FontStyle.Regular); for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.AddXY(" ", dt.Rows[i]["TARGET_MS"]); } for (int i = 0; i < dt.Rows.Count; i++) { series2.Points.AddY(dt.Rows[i]["RESULT_MS"]); } //DataTable dtData = DataTypeUtility.FilterSortDataTable(dt, "KPI_REF_ID > 0"); //if(k == 0) //{ // series1.Points.AddXY("계획", dt.Rows[k]["TARGET_TS"]); // series1.Points.AddXY("실적", dt.Rows[k]["RESULT_TS"]); //} //else //{ // series1.Points.AddY(dt.Rows[k]["TARGET_TS"]); // series1.Points.AddY(dt.Rows[k]["RESULT_TS"]); //} //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 10, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); //DataRow[] drCol = dt.Select(string.Format("KPI_REF_ID < 0")); //DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); //if(drCol.Length > 0) //{ // lbl.Text = DataTypeUtility.GetToDouble(drCol[0]["RNF_RATE"]).ToString("#,##0.00") + "%"; //} //else //{ // lbl.Text = "0" + "%"; //} }
private void BindRadarChart(Chart chart , string query , BiasType biasType , ChartImageType chartImageType) { //DundasCharts.DundasChartBase(chart // , chartImageType // , 800 // , 400 // , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 // , Color.FromArgb(0xFF, 0xFF, 0xFE) // , Color.FromArgb(0xFF, 0xFF, 0xFE) // , Color.FromArgb(0x20, 0x80, 0xD0) // , ChartDashStyle.Solid // , -1 // , ChartHatchStyle.None // , GradientType.TopBottom // , AntiAliasing.None); Biz_DundasCharts.DundasChartBase(chart , chartImageType , 800 , 400 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); //Series series1 = DundasCharts.CreateSeries(chart // , "Series1" // , "Default" // , "최대값" // , null // , SeriesChartType.Radar // , 1 // , Color.FromArgb(0x5A, 0x7D, 0xDE) // , Color.FromArgb(0x4A, 0x58, 0x7E) // , Color.FromArgb(64, 0, 0, 0) // , 1 // , 9 // , Color.FromArgb(64, 64, 64)); Series series1 = Biz_DundasCharts.CreateSeries(chart , "Series1" , "Default" , "최대값" , null , SeriesChartType.Radar , 1 , Color.FromArgb(0x5A, 0x7D, 0xDE) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //Series series2 = DundasCharts.CreateSeries(chart // , "Series2" // , "Default" // , "최소값" // , null // , SeriesChartType.Radar // , 1 // , Color.FromArgb(0xFF, 0x8A, 0x00) // , Color.FromArgb(0xD7, 0x41, 0x01) // , Color.FromArgb(64, 0, 0, 0) // , 1 // , 9 // , Color.FromArgb(64, 64, 64)); Series series2 = Biz_DundasCharts.CreateSeries(chart , "Series2" , "Default" , "최소값" , null , SeriesChartType.Radar , 1 , Color.FromArgb(0xFF, 0x8A, 0x00) , Color.FromArgb(0xD7, 0x41, 0x01) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); series1.ToolTip = "#VALY{#,##0}"; series2.ToolTip = "#VALY{#,##0}"; series1.MarkerStyle = MarkerStyle.Circle; series2.MarkerStyle = MarkerStyle.Diamond; series1.MarkerColor = Color.FromArgb(0x7A, 0x9D, 0xFE); series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); series1.MarkerBorderColor = Color.FromArgb(0x4A, 0x58, 0x7E); series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); ArrayList yValues1; ArrayList yValues2; ArrayList xValues; //DundasCharts.SetDataFieldsX1(query // , "EST_EMP_NAME" // , out xValues // , "PNT_MAX" // , out yValues1 // , "PNT_MIN" // , out yValues2); Biz_DundasCharts.SetDataFieldsX1(query , "EST_EMP_NAME" , out xValues , "PNT_MAX" , out yValues1 , "PNT_MIN" , out yValues2); series1.Points.DataBindXY(xValues, yValues1); series2.Points.DataBindXY(xValues, yValues2); if (chartImageType == ChartImageType.Flash) { DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.0, 3.0, false); DundasAnimations.GrowingAnimation(chart, series2, 3.0, 6.0, true); } // Set radar chart style Line, Area, Marker series1["RadarDrawingStyle"] = "Line"; series2["RadarDrawingStyle"] = "Line"; // Set circular area drawing style //Circle, Polygon series1["AreaDrawingStyle"] = "Polygon"; series2["AreaDrawingStyle"] = "Polygon"; // Set labels style //Horizontal, Circular, Radial series1["CircularLabelsStyle"] = "Horizontal"; series2["CircularLabelsStyle"] = "Horizontal"; string titleStr = ""; if (biasType == BiasType.ORG) { titleStr = "원시 점수"; } else if (biasType == BiasType.AVG) { titleStr = "평균조정 점수"; } else if (biasType == BiasType.STD) { titleStr = "평균편차조정 점수"; } Font font = new Font("Gulim", 13, FontStyle.Regular); Font font1 = new Font("Gulim", 9, FontStyle.Regular); //Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart // , "Title1" // , titleStr, font // , Color.FromArgb(26, 59, 105) // , Color.Empty // , Color.Empty // , ContentAlignment.TopCenter // , null // , Color.FromArgb(32, 0, 0, 0) // , 3 // , false // , 5 // , 5 // , 91 // , 6); Dundas.Charting.WebControl.Title title = Biz_DundasCharts.CreateTitle(chart , "Title1" , titleStr, font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 5 , 91 , 6); //Legend legend = DundasCharts.CreateLegend(chart // , "Default" // , Color.Transparent // , Color.Empty // , Color.Empty // , font1 // , false // , 75 // , 75 // , 20 // , 15); Legend legend = Biz_DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty , font1 , false , 75 , 75 , 20 , 15); //DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); Biz_DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); }
private void BindChart(Chart chart , DataTable dt , string titleName) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 480 , 150 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = DundasCharts.CreateSeries(chart , "Series1" , "Default" , "매출액" , null , SeriesChartType.Column , 1 , GetChartColor(0) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); Series series2 = DundasCharts.CreateSeries(chart , "Series2" , "Default" , "영업이익" , null , SeriesChartType.Column , 1 , GetChartColor(1) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); //series1.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; series2.ToolTip = "#VALY{N0}"; //series1.ShowLabelAsValue = true; //series1.ShowInLegend = true; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); DundasAnimations.GrowingAnimation(chart, series2, 0.5, 1.5, true); //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points[i].AxisLabel = dt.Rows[i]["ALIAS"].ToString(); //} //for (int i = 0; i < dt.Rows.Count; i++) //{ // series1.Points.AddY(dt.Rows[i]["RESULT_TS"]); //} series1.Font = new Font("굴림", 7, FontStyle.Regular); series2.Font = new Font("굴림", 7, FontStyle.Regular); if (dt.Rows.Count > 0) { series1.Points.AddXY("당월", dt.Rows[0]["RESULT_MS"]); series1.Points.AddXY("누계", dt.Rows[0]["RESULT_TS"]); series1.Points.AddXY("전년동기실적", dt.Rows[0]["BF_RESULT_TS"]); series2.Points.AddY(dt.Rows[1]["RESULT_MS"]); series2.Points.AddY(dt.Rows[1]["RESULT_TS"]); series2.Points.AddY(dt.Rows[1]["BF_RESULT_TS"]); } //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); }
private void BindChart(Chart chart , DataTable dt , string titleName , System.Web.UI.WebControls.Label lbl1 , System.Web.UI.WebControls.Label lbl2 , System.Web.UI.WebControls.Label lbl3) { DundasCharts.DundasChartBase(chart , ChartImageType.Flash , 480 , 220 , BorderSkinStyle.Emboss , Color.FromArgb(181, 64, 1) , 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0x20, 0x80, 0xD0) , ChartDashStyle.Solid , -1 , ChartHatchStyle.None , GradientType.TopBottom , AntiAliasing.None); Series series1 = null; for (int k = 0; k < dt.Rows.Count; k++) { if (DataTypeUtility.GetToInt32(dt.Rows[k]["KPI_REF_ID"]) < 0) { continue; } series1 = DundasCharts.CreateSeries(chart , "Series" + k.ToString() , "Default" , dt.Rows[k]["ALIAS"].ToString() , null , SeriesChartType.StackedColumn , 1 , GetChartColor(k) , Color.FromArgb(0x4A, 0x58, 0x7E) , Color.FromArgb(64, 0, 0, 0) , 1 , 9 , Color.FromArgb(64, 64, 64)); series1.Label = "#VALY{N0}"; series1.ToolTip = "#VALY{N0}"; //series1.ShowLabelAsValue = true; //series1.ShowInLegend = true; chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "N0"; DundasAnimations.DundasChartBase(chart, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(chart, series1, 0.5, 1.5, true); series1.Font = new Font("굴림", 7, FontStyle.Regular); DataTable dtData = DataTypeUtility.FilterSortDataTable(dt, "KPI_REF_ID > 0"); if (k == 0) { series1.Points.AddXY("계획", dt.Rows[k]["TARGET_TS"]); series1.Points.AddXY("실적", dt.Rows[k]["RESULT_TS"]); } else { series1.Points.AddY(dt.Rows[k]["TARGET_TS"]); series1.Points.AddY(dt.Rows[k]["RESULT_TS"]); } //series1.ToolTip = "#VALY{#,##0,00}"; //series2.ToolTip = "#VALY{#,##0}"; } //series2.MarkerStyle = MarkerStyle.Circle; //series2.MarkerColor = Color.FromArgb(0xFF, 0xAA, 0x20); //series2.MarkerBorderColor = Color.FromArgb(0xD7, 0x41, 0x01); Font font = new Font("Gulim", 11, FontStyle.Regular); Dundas.Charting.WebControl.Title title = DundasCharts.CreateTitle(chart , "Title1" , titleName , font , Color.FromArgb(26, 59, 105) , Color.Empty , Color.Empty , ContentAlignment.TopCenter , null , Color.FromArgb(32, 0, 0, 0) , 3 , false , 5 , 7 , 91 , 6); Legend legend = DundasCharts.CreateLegend(chart , "Default" , Color.Transparent , Color.Empty , Color.Empty); legend.AutoFitText = false; legend.Position = new ElementPosition(80, 7, 50, 20); legend.Font = new Font("굴림", 7, FontStyle.Regular); DataRow[] drCol = dt.Select(string.Format("KPI_REF_ID < 0")); DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); if (drCol.Length > 0) { lbl1.Text = DataTypeUtility.GetToDouble(drCol[0]["RNF_RATE"]).ToString("#,##0.00") + "%"; } else { lbl1.Text = "0" + "%"; } drCol = dt.Select(string.Format("KPI_REF_ID < 0")); DundasCharts.SetChartArea(chart.ChartAreas["Default"], false); if (drCol.Length > 0) { lbl2.Text = DataTypeUtility.GetToDouble(drCol[0]["TARGET_TS"]).ToString("#,##0") + ""; lbl3.Text = DataTypeUtility.GetToDouble(drCol[0]["RESULT_TS"]).ToString("#,##0") + ""; } else { lbl2.Text = "0" + ""; lbl3.Text = "0" + ""; } }
protected void GenerateChart(System.Data.DataTable dataValues, string logic) { int rowCount = dataValues.Rows.Count; if (rowCount >= 1) { this.AvailibilityChartFleetComparison.Visible = true; this.EmptyDataTemplateFleetComparison.Visible = false; } else { this.EmptyDataTemplateFleetComparison.Visible = true; this.AvailibilityChartFleetComparison.Visible = false; } Dundas.Charting.WebControl.Chart ChartFleetComparison = (Dundas.Charting.WebControl.Chart) this.AvailibilityChartFleetComparison.FindControl("DundasChartAvailability"); ChartFleetComparison.Series.Clear(); ChartFleetComparison.Titles.Clear(); Dundas.Charting.WebControl.Title ctitle = new Dundas.Charting.WebControl.Title(); ctitle.Text = Resources.lang.FleetComparison; ctitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); ctitle.Alignment = System.Drawing.ContentAlignment.TopLeft; ChartFleetComparison.Titles.Add(ctitle); //Add a item to reset zoom Dundas.Charting.WebControl.Title resetZoomTitle = new Dundas.Charting.WebControl.Title(); resetZoomTitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); resetZoomTitle.Alignment = System.Drawing.ContentAlignment.BottomRight; resetZoomTitle.Docking = Docking.Bottom; resetZoomTitle.ToolTip = Resources.lang.ChartZoomFeature; resetZoomTitle.DockOffset = 1; resetZoomTitle.MapAreaAttributes = "onclick=\"" + ChartFleetComparison.CallbackManager.GetCallbackEventReference("ResetZoom", "ResetZoom") + "\""; resetZoomTitle.Text = Resources.lang.ChartZoomText; resetZoomTitle.BackImage = "~/App.images/reset_zoom.png"; resetZoomTitle.BackImageMode = ChartImageWrapMode.Unscaled; resetZoomTitle.BackImageAlign = ChartImageAlign.BottomRight; ChartFleetComparison.Titles.Add(resetZoomTitle); Series series1 = ChartFleetComparison.Series.Add("Default"); //Set the chart type series1.Type = SeriesChartType.Column; // Initializes a new instance of the DataView class System.Data.DataView firstView = new System.Data.DataView(dataValues); // Since the DataView implements IEnumerable, pass the reader directly into // the DataBind method with the name of the Columns selected in the query ChartFleetComparison.Series["Default"].Points.DataBindXY(firstView, "car_group", firstView, "car_count"); //Change the way labels are displayed when there's more columns series1.ShowLabelAsValue = true; series1.SmartLabels.Enabled = true; series1.SmartLabels.MovingDirection = LabelAlignment.Top; //Set label tooltip to Y value series1.LabelToolTip = "#VALX: #VAL"; //Set series bars tooltip toY value also series1.ToolTip = "#VALX: #VAL"; // Sort series in ascending order by the default Y value. ChartFleetComparison.DataManipulator.Sort(PointsSortOrder.Descending, "Default"); // Sort series in ascending order by the second Y value. series1.BackGradientType = GradientType.TopBottom; series1.Color = System.Drawing.Color.FromArgb(230, 0, 125, 255); series1.BackGradientEndColor = System.Drawing.Color.Aqua; //If the current number of samples is bigger than 10 make the size of font smaller if (dataValues.Rows.Count > 10) { //Set Data Point Label series1["LabelStyle"] = "Top"; // Set labels font series1.Font = new System.Drawing.Font("Arial", 6, System.Drawing.FontStyle.Bold); // Set labels color series1.FontColor = System.Drawing.Color.Black; } else { //Set Data Point Label series1["LabelStyle"] = "Bottom"; // Set labels font series1.Font = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Bold); // Set labels color series1.FontColor = System.Drawing.Color.Black; // Set ColumnLabel Style series1["ColumnLabelStyle"] = "Horizontal"; } if (logic == "PERCENTAGE") { // Set Y axis labels format ChartFleetComparison.ChartAreas["Default"].AxisY.LabelStyle.Format = "P0"; // Set series point labels format ChartFleetComparison.Series["Default"].LabelFormat = "P2"; } else { //Restore decimal formatting - since we're using ViewState for charts, formatting won't be reset automatically ChartFleetComparison.ChartAreas["Default"].AxisY.LabelStyle.Format = "D"; ChartFleetComparison.Series["Default"].LabelFormat = "D"; } //Set X Axis style ChartFleetComparison.ChartAreas["Default"].AxisX.LabelsAutoFit = false; ChartFleetComparison.ChartAreas["Default"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 7, System.Drawing.FontStyle.Bold); ChartFleetComparison.ChartAreas["Default"].AxisX.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartFleetComparison.ChartAreas["Default"].AxisX.Interlaced = false; ChartFleetComparison.ChartAreas["Default"].AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartFleetComparison.ChartAreas["Default"].AxisX.LabelStyle.FontAngle = -45; ChartFleetComparison.ChartAreas["Default"].AxisY.LabelStyle.Font = new System.Drawing.Font("Arial", 7, System.Drawing.FontStyle.Bold); ChartFleetComparison.ChartAreas["Default"].AxisY.LineColor = System.Drawing.Color.Gray; ChartFleetComparison.ChartAreas["Default"].AxisY.Interlaced = true; ChartFleetComparison.ChartAreas["Default"].AxisY.InterlacedColor = System.Drawing.Color.FromArgb(20, 20, 20, 20); ChartFleetComparison.ChartAreas["Default"].AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); //Disable Variable Label Intervals - force showing every X Value ChartFleetComparison.ChartAreas["Default"].AxisX.Interval = 1; // Enable AntiAliasing for either Text and Graphics or just Graphics ChartFleetComparison.AntiAliasing = AntiAliasing.All; }
protected void GenerateChart(System.Data.DataTable dataValues, int dateRangeValue, string logic) { int rowCount = dataValues.Rows.Count; if (rowCount >= 1) { this.AvailibilityChartHistoricalTrend.Visible = true; this.EmptyDataTemplateHistoricalTrend.Visible = false; } else { this.EmptyDataTemplateHistoricalTrend.Visible = true; this.AvailibilityChartHistoricalTrend.Visible = false; } Dundas.Charting.WebControl.Chart ChartHistoricalTrend = (Dundas.Charting.WebControl.Chart) this.AvailibilityChartHistoricalTrend.FindControl("DundasChartAvailability"); ChartHistoricalTrend.Series.Clear(); ChartHistoricalTrend.Legends.Clear(); ChartHistoricalTrend.Legends.Add("Default"); ChartHistoricalTrend.Legends["Default"].LegendStyle = LegendStyle.Column; ChartHistoricalTrend.Visible = true; //reset chart title ChartHistoricalTrend.Titles.Clear(); Dundas.Charting.WebControl.Title ctitle = new Dundas.Charting.WebControl.Title(); ctitle.Text = Resources.lang.HistoricalTrend; ctitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); ctitle.Alignment = System.Drawing.ContentAlignment.TopLeft; ChartHistoricalTrend.Titles.Add(ctitle); //Add a item to reset zoom Dundas.Charting.WebControl.Title resetZoomTitle = new Dundas.Charting.WebControl.Title(); resetZoomTitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); resetZoomTitle.Alignment = System.Drawing.ContentAlignment.BottomRight; resetZoomTitle.Docking = Docking.Bottom; resetZoomTitle.ToolTip = Resources.lang.ChartZoomFeature; resetZoomTitle.DockOffset = 1; resetZoomTitle.MapAreaAttributes = "onclick=\"" + ChartHistoricalTrend.CallbackManager.GetCallbackEventReference("ResetZoom", "ResetZoom") + "\""; resetZoomTitle.Text = Resources.lang.ChartZoomText; resetZoomTitle.BackImage = "~/App.Images/reset_zoom.png"; resetZoomTitle.BackImageMode = ChartImageWrapMode.Unscaled; resetZoomTitle.BackImageAlign = ChartImageAlign.BottomRight; ChartHistoricalTrend.Titles.Add(resetZoomTitle); //Declare chart series // remove carsales, gold and predelivery from the dataview Series series1 = ChartHistoricalTrend.Series.Add("TOTAL FLEET"); //Series series2 = ChartHistoricalTrend.Series.Add("CARSALES"); // removed to protect the innocent Series series3 = ChartHistoricalTrend.Series.Add("CU"); Series series4 = ChartHistoricalTrend.Series.Add("HA"); Series series5 = ChartHistoricalTrend.Series.Add("HL"); Series series6 = ChartHistoricalTrend.Series.Add("LL"); Series series7 = ChartHistoricalTrend.Series.Add("NC"); Series series8 = ChartHistoricalTrend.Series.Add("PL"); Series series9 = ChartHistoricalTrend.Series.Add("TC"); Series series10 = ChartHistoricalTrend.Series.Add("SV"); Series series11 = ChartHistoricalTrend.Series.Add("WS"); Series series12 = ChartHistoricalTrend.Series.Add("OPERATIONAL FLEET"); Series series13 = ChartHistoricalTrend.Series.Add("BD"); Series series14 = ChartHistoricalTrend.Series.Add("MM"); Series series15 = ChartHistoricalTrend.Series.Add("TW"); Series series16 = ChartHistoricalTrend.Series.Add("TB"); Series series17 = ChartHistoricalTrend.Series.Add("FS"); Series series18 = ChartHistoricalTrend.Series.Add("RL"); Series series19 = ChartHistoricalTrend.Series.Add("RP"); Series series20 = ChartHistoricalTrend.Series.Add("TN"); Series series21 = ChartHistoricalTrend.Series.Add("AVAILABLE FLEET"); Series series22 = ChartHistoricalTrend.Series.Add("RT"); Series series23 = ChartHistoricalTrend.Series.Add("SU"); //Series series24 = ChartHistoricalTrend.Series.Add("GOLD"); //Series series25 = ChartHistoricalTrend.Series.Add("PREDELIVERY"); Series series26 = ChartHistoricalTrend.Series.Add("OVERDUE"); Series series27 = ChartHistoricalTrend.Series.Add("ON RENT"); string xAxisValue = "REP_DATE"; // set to default if (dateRangeValue < -30 && dateRangeValue >= -90) { xAxisValue = "REP_WEEK_OF_YEAR"; } if (dateRangeValue < -90) { xAxisValue = "REP_MONTH"; } // Initializes a new instance of the DataView class System.Data.DataView firstView = new System.Data.DataView(dataValues); // Since the DataView implements IEnumerable, pass the reader directly into // the DataBind method with the name of the Columns selected in the query //Set series properties int index = 0; foreach (Series chartSeries in ChartHistoricalTrend.Series) { chartSeries.Points.DataBindXY(firstView, xAxisValue, firstView, chartSeries.Name.Replace(" ", "_")); if (logic == "PERCENTAGE") { foreach (DataPoint p in chartSeries.Points) { //p.YValues[0] = Math.Round(p.YValues[0], 2); p.LabelFormat = "P"; } } chartSeries.Color = Charts.GetColourForColumn(chartSeries.Name, (int)ReportSettings.ReportSettingsTool.Availability); switch (chartSeries.Name) { case "AVAILABLE FLEET": case "RT": case "SU": //case "GOLD": //case "PREDELIVERY": case "OVERDUE": case "ON RENT": chartSeries.Enabled = true; break; default: chartSeries.Enabled = false; break; } // Set range column chart type chartSeries.Type = SeriesChartType.Line; //Set series tooltip chartSeries.ToolTip = "#VALX: #VAL, #SERIESNAME"; // Set the side-by-side drawing style chartSeries["DrawSideBySide"] = "false"; chartSeries.BorderWidth = 2; //Set x value type if (xAxisValue == "REP_DATE") { chartSeries.XValueType = ChartValueTypes.DateTime; } else { chartSeries.XValueType = ChartValueTypes.Int; } chartSeries.Color = Charts.GetColourForColumn(chartSeries.Name, (int)ReportSettings.ReportSettingsTool.Availability); chartSeries.ShowInLegend = false; // Add custom legend item with image LegendItem legendItem = new LegendItem(); LegendCell legendCell1 = new LegendCell(); LegendCell legendCell2 = new LegendCell(); legendItem.BackImageTranspColor = System.Drawing.Color.Red; legendCell1.CellType = LegendCellType.Image; if (chartSeries.Enabled == true) { legendCell1.Image = "~/App.Images/chk_checked.png"; } else { legendCell1.Image = "~/App.Images/chk_unchecked.png"; } legendCell1.ImageTranspColor = System.Drawing.Color.Red; legendCell2.CellType = LegendCellType.Text; legendCell2.Font = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Regular); legendCell2.Text = chartSeries.Name; legendCell2.TextColor = chartSeries.Color; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell2); legendItem.MapAreaAttributes = "onclick=\"" + ChartHistoricalTrend.CallbackManager.GetCallbackEventReference("LegendClick", index.ToString()) + "\""; legendItem.BorderWidth = 0; ChartHistoricalTrend.Legends["Default"].CustomItems.Add(legendItem); index += 1; } var yLabelStyle = string.Empty; switch (logic) { case "PERCENTAGE": yLabelStyle = "P"; break; case "NUMERIC": yLabelStyle = "D"; break; default: yLabelStyle = "P0"; break; } ChartHistoricalTrend.ChartAreas["Default"].AxisY.LabelStyle.Format = yLabelStyle; //Set X Axis style ChartHistoricalTrend.ChartAreas["Default"].AxisX.LabelsAutoFit = false; ChartHistoricalTrend.ChartAreas["Default"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 7, System.Drawing.FontStyle.Bold); ChartHistoricalTrend.ChartAreas["Default"].AxisX.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartHistoricalTrend.ChartAreas["Default"].AxisX.Interlaced = false; ChartHistoricalTrend.ChartAreas["Default"].AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartHistoricalTrend.ChartAreas["Default"].AxisX.LabelStyle.FontAngle = -45; ChartHistoricalTrend.ChartAreas["Default"].AxisY.LabelStyle.Font = new System.Drawing.Font("Arial", 7, System.Drawing.FontStyle.Bold); ChartHistoricalTrend.ChartAreas["Default"].AxisY.LineColor = System.Drawing.Color.Gray; ChartHistoricalTrend.ChartAreas["Default"].AxisY.Interlaced = true; ChartHistoricalTrend.ChartAreas["Default"].AxisY.InterlacedColor = System.Drawing.Color.FromArgb(20, 20, 20, 20); ChartHistoricalTrend.ChartAreas["Default"].AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); //Disable Variable Label Intervals - force showing every X Value ChartHistoricalTrend.ChartAreas["Default"].AxisX.Interval = 1; // Enable AntiAliasing for either Text and Graphics or just Graphics ChartHistoricalTrend.AntiAliasing = AntiAliasing.All; }
protected void GenerateChart(System.Data.DataTable dataValues, string grouping_criteria, string logic, string kpi_text, string kpi_value) { // logic is value or percentage // kpi_text is the value of the dropdownlist (right of generate report button) // kpi_value us the value from the dropdownlist (as above) int rowCount = dataValues.Rows.Count; if (rowCount >= 1) { this.AvailibilityChartKPI.Visible = true; this.EmptDataTemplateKPI.Visible = false; } else { this.EmptDataTemplateKPI.Visible = true; this.AvailibilityChartKPI.Visible = false; } Dundas.Charting.WebControl.Chart ChartKPI = (Dundas.Charting.WebControl.Chart) this.AvailibilityChartKPI.FindControl("DundasChartAvailability"); ChartKPI.Series.Clear(); ChartKPI.Titles.Clear(); Dundas.Charting.WebControl.Title ctitle = new Dundas.Charting.WebControl.Title(); ctitle.Text = Resources.lang.KPI + ": " + kpi_text; ctitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); ctitle.Alignment = System.Drawing.ContentAlignment.TopLeft; ChartKPI.Titles.Add(ctitle); // ---- Alteration by Gavin ---- BLL.ChartFactory.BuildLegend bl = new BLL.ChartFactory.BuildLegend("Formulae"); int legendIndex = bl.indexOf(ChartKPI); if (legendIndex > -1) // delete at index { ChartKPI.Legends.RemoveAt(legendIndex); } //Add a item to reset zoom Dundas.Charting.WebControl.Title resetZoomTitle = new Dundas.Charting.WebControl.Title(); resetZoomTitle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold); resetZoomTitle.Alignment = System.Drawing.ContentAlignment.BottomRight; resetZoomTitle.Docking = Docking.Bottom; resetZoomTitle.ToolTip = Resources.lang.ChartZoomFeature; resetZoomTitle.DockOffset = 1; resetZoomTitle.MapAreaAttributes = "onclick=\"" + ChartKPI.CallbackManager.GetCallbackEventReference("ResetZoom", "ResetZoom") + "\""; resetZoomTitle.Text = Resources.lang.ChartZoomText; resetZoomTitle.BackImage = "~/App.Images/reset_zoom.png"; resetZoomTitle.BackImageMode = ChartImageWrapMode.Unscaled; resetZoomTitle.BackImageAlign = ChartImageAlign.BottomRight; ChartKPI.Titles.Add(resetZoomTitle); // has been changed to a range to coincide with the changes in the ReportSettings - getGroupingCriteria, changed to getRangeGroupingCriteria // convert the grouping criteria to a range int groupingCriteriaRange = Convert.ToInt32(grouping_criteria); string xAxisValue = "REP_MONTH"; // default if (groupingCriteriaRange >= -180) { xAxisValue = "REP_WEEK_OF_YEAR"; } if (groupingCriteriaRange >= -30) { xAxisValue = "REP_DATE"; } // Initializes a new instance of the DataView class System.Data.DataView firstView = new System.Data.DataView(dataValues); switch (kpi_value) { case "OperationalUtilization": case "Overdues": case "IdleFleet": case "RentableFleetOnPeak": //Declare chart series Series series1 = ChartKPI.Series.Add("KPI"); Series seriesMin = ChartKPI.Series.Add("Min"); Series seriesMax = ChartKPI.Series.Add("Max"); Series seriesAvg = ChartKPI.Series.Add("Avg"); // ---- Altered by Gavin ---- ChartKPI.Legends.Add(bl.getLegend(kpi_value, logic)); // Since the DataView implements IEnumerable, pass the reader directly into // the DataBind method with the name of the Columns selected in the query series1.Points.DataBindXY(firstView, xAxisValue, firstView, "KPI"); decimal min = (decimal)0.0; decimal max = (decimal)0.0; decimal avg = (decimal)0.0; if (dataValues.Rows.Count > 0) { min = Math.Round(Convert.ToDecimal(dataValues.Compute("MIN(KPI)", "KPI>=0")), 2); max = Math.Round(Convert.ToDecimal(dataValues.Compute("MAX(KPI)", "KPI>=0")), 2); avg = Math.Round(Convert.ToDecimal(dataValues.Compute("AVG(KPI)", "KPI>=0")), 2); } foreach (DataPoint point in series1.Points) { seriesMin.Points.AddXY(point.XValue, min); seriesMax.Points.AddXY(point.XValue, max); seriesAvg.Points.AddXY(point.XValue, avg); } //Set series colors series1.Color = System.Drawing.Color.Navy; seriesMin.Color = System.Drawing.Color.Red; seriesMax.Color = System.Drawing.Color.Green; seriesAvg.Color = System.Drawing.Color.Cyan; break; case "FleetStatus": case "AvailableFleet": case "UnavailableOperationalFleet": case "UnavailableNonOperationalFleet": //Count how many series was retrieved by DB query int seriesStartIndex = 4; // Set to 4 because the first three columns contain date info for (int index1 = seriesStartIndex; index1 <= dataValues.Columns.Count - 1; index1++) { Series newSeries = ChartKPI.Series.Add(dataValues.Columns[index1].ColumnName); newSeries.Points.DataBindXY(firstView, xAxisValue, firstView, dataValues.Columns[index1].ColumnName); newSeries.Color = Charts.GetColourForColumn((dataValues.Columns[index1].ColumnName.Replace("_", " ")), (int)ReportSettings.ReportSettingsTool.Availability); } break; default: break; } if (logic == "NUMERIC") { //Restore decimal formatting - because we're using ViewState for charts, formatting won't be reset automatically ChartKPI.ChartAreas["Default"].AxisY.LabelStyle.Format = "D"; } else { // Set Y axis labels format ChartKPI.ChartAreas["Default"].AxisY.LabelStyle.Format = "P0"; } //Set series properties int index = 0; foreach (Series chartSeries in ChartKPI.Series) { //Set series visibility chartSeries.Enabled = true; // Set range column chart type chartSeries.Type = SeriesChartType.Line; //Set series tooltip chartSeries.ToolTip = "#VALX: #VAL, #SERIESNAME"; // Set the side-by-side drawing style chartSeries["DrawSideBySide"] = "false"; chartSeries.BorderWidth = 2; //Set x value type if (xAxisValue == "REP_DATE") { chartSeries.XValueType = ChartValueTypes.DateTime; } else { chartSeries.XValueType = ChartValueTypes.Int; } // Set series point labels format chartSeries.LabelFormat = logic == "NUMERIC" ? string.Empty : "P2"; chartSeries.ShowInLegend = true; index += 1; } //Set X Axis style ChartKPI.ChartAreas["Default"].AxisX.LabelsAutoFit = true; ChartKPI.ChartAreas["Default"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Bold); ChartKPI.ChartAreas["Default"].AxisX.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartKPI.ChartAreas["Default"].AxisX.Interlaced = false; ChartKPI.ChartAreas["Default"].AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); ChartKPI.ChartAreas["Default"].AxisX.LabelStyle.FontAngle = -45; ChartKPI.ChartAreas["Default"].AxisY.LabelStyle.Font = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Bold); ChartKPI.ChartAreas["Default"].AxisY.LineColor = System.Drawing.Color.Gray; ChartKPI.ChartAreas["Default"].AxisY.Interlaced = true; ChartKPI.ChartAreas["Default"].AxisY.InterlacedColor = System.Drawing.Color.FromArgb(20, 20, 20, 20); ChartKPI.ChartAreas["Default"].AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(64, 64, 64, 64); //Disable Variable Label Intervals - force showing every X Value ChartKPI.ChartAreas["Default"].AxisX.Interval = 1; // Enable AntiAliasing for either Text and Graphics or just Graphics ChartKPI.AntiAliasing = AntiAliasing.All; }