public string GetChart() { chart = new MSCombiDY2D(defaultAttributes) { Dataset = new List <DataSet>(), }; if (KPI.ToUpper() == "SALES") { chart.Attributes.Add("pyAxisName", "In " + UnitValue + " 000"); chart.Attributes.Add("sYAXisName", "In %"); } chart.ControlId = "interactiveTrendChart"; if (KPI.ToUpper() == "SALES PERFORMANCE VS COMPETITORS") { chart.Attributes.Add("pyAxisName", ""); chart.Attributes.Add("sYAXisName", "In " + UnitValue + " 000"); } AddStyles(); if (RevertAxis && KPI.ToUpper() == "SALES PERFORMANCE VS COMPETITORS") { foreach (Row t in Input.Rows.Skip(1)) { var category = new Category(); category.Attributes.Add("label", t.Values[1]); chart.Categories.Category.Add(category); } foreach (var col in Input.Columns.Skip(3)) { var dataSet = new DataSet("renderas='Line'"); if (PeriodType == "MAT" || PeriodType == "YTD") { dataSet.Attributes.Add("seriesName", PeriodType + " " + col.Name.Split('_').ToArray()[0]); } else { dataSet.Attributes.Add("seriesName", col.Name.Split('_').ToArray()[0]); } dataSet.Attributes.Add("parentyaxis", "S"); dataSet.Set = new List <Set>(); string color = _colorList.GetNextColor(); dataSet.Attributes.Add("color", "#" + color); dataSet.Attributes.Add("anchorBgColor", "#" + color); foreach (var row in Input.Rows.Skip(1)) { var set1 = new Set(); set1.Attributes.Add("value", row[col.Position] == "--" ? "0" : row[col.Position]); dataSet.Set.Add(set1); } chart.Dataset.Add(dataSet); } } else { foreach (var col in KPI.ToUpper() == "SALES" ? Input.Columns.Skip(2) : Input.Columns.Skip(3)) { var category = new Category(); if (PeriodType == "MAT" || PeriodType == "YTD") { category.Attributes.Add("label", PeriodType + " " + col.Name.Split('_').ToArray()[0]); } else { category.Attributes.Add("label", col.Name.Split('_').ToArray()[0]); } chart.Categories.Category.Add(category); } if (!UncheckedItems.Contains(Input.Rows[0].Values[1])) { chart.Dataset.Add(AddFirstDataSet()); } for (var i = 1; i < Input.Rows.Count; i++) { if (!UncheckedItems.Contains(Input.Rows[i].Values[1])) { chart.Dataset.Add(AddTrendLineDataSet(Input.Rows[i])); } } } return(chart.RenderWithScript("98%", "360", isForceHtmlRender: true)); }
public string GetChart() { chart = new MSLineChart(defaultAttributes) { Dataset = new List <DataSet>() }; if (KPI.ToUpper() == "MARKET SHARE") { chart.Attributes.Add("yAxisName", "In %"); } if (KPI.ToUpper() == "EVOLUTION INDEX") { chart.Attributes.Add("yAxisName", "Index in 000"); } chart.ControlId = "interactiveTrendChart"; AddStyles(); if (RevertAxis && (KPI.ToUpper() == "EVOLUTION INDEX" || KPI.ToUpper() == "MARKET SHARE")) { foreach (Row t in Input.Rows) { var category = new Category(); category.Attributes.Add("label", t.Values[1]); chart.Categories.Category.Add(category); } foreach (var col in Input.Columns.Skip(3)) { var dataSet = new DataSet("renderas='Line'"); if (PeriodType == "MAT" || PeriodType == "YTD") { dataSet.Attributes.Add("seriesName", PeriodType + " " + col.Name.Split('_').ToArray()[0]); } else { dataSet.Attributes.Add("seriesName", col.Name.Split('_').ToArray()[0]); } dataSet.Attributes.Add("parentyaxis", "S"); dataSet.Set = new List <Set>(); string color = _colorList.GetNextColor(); dataSet.Attributes.Add("color", "#" + color); dataSet.Attributes.Add("anchorBgColor", "#" + color); foreach (var row in Input.Rows) { var set1 = new Set(); set1.Attributes.Add("value", row[col.Position] == "--" ? "0" : row[col.Position]); dataSet.Set.Add(set1); } chart.Dataset.Add(dataSet); } } else { foreach (var col in Input.Columns.Skip(3)) { var category = new Category(); category.Attributes.Add("label", col.Name.Split('_').ToArray()[0]); chart.Categories.Category.Add(category); } for (int i = 0; i < Input.Rows.Count; i++) { if (!UncheckedItems.Contains(Input.Rows[i].Values[1])) { chart.Dataset.Add(AddTrendLineDataSet(Input.Rows[i])); } } } return(chart.RenderWithScript("98%", "360", isForceHtmlRender: true)); }