private void ReportServices_DailyGrab_GenVehicleData_SOCByPacks(Vehicles v, DateTime dt, string dtype) { string dtypeLabel = string.Empty; if (dtype == "MinSoC") { dtypeLabel = " Min "; } else if (dtype == "MaxSoC") { dtypeLabel = " Max "; } GetChartData gd = new GetChartData(); DataTable dataTable = gd.Dt_DailyGrab_GetSoCbyPacks(v.VinID, dt, Rounding); string mainTitle = string.Format("Soc {0} Daily - {1}", dtypeLabel, dt.ToString("MM/dd/yy")); string subTitle = string.Format("{0} - {1}", v.CustomerName, v.Vin); hcVendas.Title = new Title(mainTitle); hcVendas.SubTitle = new SubTitle(subTitle); hcVendas.Theme = "grid"; hcVendas.Legend = new Legend { align = Align.right, layout = Layout.vertical, verticalAlign = VerticalAlign.top, x = -10, y = 70, borderWidth = 0 }; hcVendas.Appearance = new Appearance { renderTo = "container", animation = false }; hcVendas.YAxis.Add(new YAxisItem { title = new Title(string.Format("Soc {0} % ", dtypeLabel)), minorGridLineWidth = 0, gridLineWidth = 0 }); hcVendas.XAxis.Add(new XAxisItem { type = AxisDataType.datetime, dateTimeLabelFormats = new DateTimeLabelFormats { hour = "%H" }, title = new Title("Time in Hours") }); hcVendas.Tooltip = new ToolTip("Highcharts.dateFormat('%H:%M', this.x) +': '+ this.y"); //Get point collection var pointCollectionSocMin = new PointCollection(); var pointCollectionSocMinPack0 = new PointCollection(); var pointCollectionSocMinPack1 = new PointCollection(); var pointCollectionSocMinPack2 = new PointCollection(); var pointCollectionSocMinPack3 = new PointCollection(); var pointCollectionSocMinPack4 = new PointCollection(); var pointCollectionSocMinPack5 = new PointCollection(); var pointCollectionSocMinPack6 = new PointCollection(); var pointCollectionSocMinPack7 = new PointCollection(); var pointCollectionSocMax = new PointCollection(); var pointCollectionSocMaxPack0 = new PointCollection(); var pointCollectionSocMaxPack1 = new PointCollection(); var pointCollectionSocMaxPack2 = new PointCollection(); var pointCollectionSocMaxPack3 = new PointCollection(); var pointCollectionSocMaxPack4 = new PointCollection(); var pointCollectionSocMaxPack5 = new PointCollection(); var pointCollectionSocMaxPack6 = new PointCollection(); var pointCollectionSocMaxPack7 = new PointCollection(); foreach (DataRow row in dataTable.Rows) { if (dtype == "MinSoC") { // pointCollectionSocMin.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCes_usi_SoCMin_pct"]))); //.pointCollectionSocMin.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCes_usi_SoCmin_pct"]))); pointCollectionSocMinPack0.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm0_usi_SoCMin_pct"]))); pointCollectionSocMinPack1.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm1_usi_SoCMin_pct"]))); pointCollectionSocMinPack2.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm2_usi_SoCMin_pct"]))); pointCollectionSocMinPack3.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm3_usi_SoCMin_pct"]))); pointCollectionSocMinPack4.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm4_usi_SoCMin_pct"]))); pointCollectionSocMinPack5.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm5_usi_SoCMin_pct"]))); pointCollectionSocMinPack6.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm6_usi_SoCMin_pct"]))); pointCollectionSocMinPack7.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm7_usi_SoCMin_pct"]))); //pointCollectionSocMinPack0.Add(new Point(Convert.ToInt64(1), Convert.ToDouble(row["PCpm0_usi_SoCMin_pct"]))); //pointCollectionSocMinPack1.Add(new Point(Convert.ToInt64(2), Convert.ToDouble(row["PCpm1_usi_SoCMin_pct"]))); //pointCollectionSocMinPack2.Add(new Point(Convert.ToInt64(3), Convert.ToDouble(row["PCpm2_usi_SoCMin_pct"]))); //pointCollectionSocMinPack3.Add(new Point(Convert.ToInt64(4), Convert.ToDouble(row["PCpm3_usi_SoCMin_pct"]))); //pointCollectionSocMinPack4.Add(new Point(Convert.ToInt64(5), Convert.ToDouble(row["PCpm4_usi_SoCMin_pct"]))); //pointCollectionSocMinPack5.Add(new Point(Convert.ToInt64(6), Convert.ToDouble(row["PCpm5_usi_SoCMin_pct"]))); //pointCollectionSocMinPack6.Add(new Point(Convert.ToInt64(7), Convert.ToDouble(row["PCpm6_usi_SoCMin_pct"]))); //pointCollectionSocMinPack7.Add(new Point(Convert.ToInt64(8), Convert.ToDouble(row["PCpm7_usi_SoCMin_pct"]))); } else if (dtype == "MaxSoC") { // pointCollectionSocMax.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCes_usi_SoCMax_pct"]))); pointCollectionSocMaxPack0.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm0_usi_SoCMax_pct"]))); pointCollectionSocMaxPack1.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm1_usi_SoCMax_pct"]))); pointCollectionSocMaxPack2.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm2_usi_SoCMax_pct"]))); pointCollectionSocMaxPack3.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm3_usi_SoCMax_pct"]))); pointCollectionSocMaxPack4.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm4_usi_SoCMax_pct"]))); pointCollectionSocMaxPack5.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm5_usi_SoCMax_pct"]))); pointCollectionSocMaxPack6.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm6_usi_SoCMax_pct"]))); pointCollectionSocMaxPack7.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCpm7_usi_SoCMax_pct"]))); } } //Add data to serie if (dtype == "MinSoC") { var seriesMin = new Collection<Serie> { // new Serie { name = "SocMin", data = pointCollectionSocMin.ToArray() }, new Serie { name = "P0", data = pointCollectionSocMinPack0.ToArray() }, new Serie { name = "P1", data = pointCollectionSocMinPack1.ToArray() }, new Serie { name = "P2", data = pointCollectionSocMinPack2.ToArray() }, new Serie { name = "P3", data = pointCollectionSocMinPack3.ToArray() }, new Serie { name = "P4", data = pointCollectionSocMinPack4.ToArray() }, new Serie { name = "P5", data = pointCollectionSocMinPack5.ToArray() }, new Serie { name = "P6", data = pointCollectionSocMinPack6.ToArray() }, new Serie { name = "P7", data = pointCollectionSocMinPack7.ToArray() } }; hcVendas.DataSource = seriesMin; } else if (dtype == "MaxSoC") { var seriesMax = new Collection<Serie> { //new Serie { name = "SocMax", data = pointCollectionSocMax.ToArray() }, new Serie { name = "P0", data = pointCollectionSocMaxPack0.ToArray() }, new Serie { name = "P1", data = pointCollectionSocMaxPack1.ToArray() }, new Serie { name = "P2", data = pointCollectionSocMaxPack2.ToArray() }, new Serie { name = "P3", data = pointCollectionSocMaxPack3.ToArray() }, new Serie { name = "P4", data = pointCollectionSocMaxPack4.ToArray() }, new Serie { name = "P5", data = pointCollectionSocMaxPack5.ToArray() }, new Serie { name = "P6", data = pointCollectionSocMaxPack6.ToArray() }, new Serie { name = "P7", data = pointCollectionSocMaxPack7.ToArray() } }; hcVendas.DataSource = seriesMax; } hcVendas.PlotOptions = new PlotOptionsLine { marker = new Marker { enabled = false }, dataLabels = new DataLabels { enabled = false }}; //Bind the control hcVendas.DataBind(); }