private void ReportServices_DailyGrab_GenVehicleData_VinSpeedHist(Vehicles v, int WeekNumber, int YearNumber) { GetChartData gd = new GetChartData(); DataTable DtRange = gd.GetDateRangeFromWeekNumber(WeekNumber,YearNumber); DataTable dataTable = gd.Dt_DailyGrab_GetVenSpeedHist(v.VinID, WeekNumber, YearNumber, Rounding); string mainTitle = string.Format("Vehicle Speed - {0} - {1} ", Convert.ToDateTime(DtRange.Rows[0]["StartDate"]).ToString("d"), Convert.ToDateTime(DtRange.Rows[0]["EndDate"]).ToString("d")); string subTitle = string.Format("{0} - {1}", v.CustomerName, v.Vin); hcFrutas.Title = new Title(mainTitle); hcFrutas.SubTitle = new SubTitle(subTitle); hcFrutas.Theme = "grid"; hcFrutas.Legend = new Legend { align = Align.right, layout = Layout.vertical, verticalAlign = VerticalAlign.top, x = -10, y = 70, borderWidth = 0 }; hcFrutas.Appearance = new Appearance { renderTo = "container", animation = false }; hcFrutas.YAxis.Add(new YAxisItem { title = new Title("Time Percentage") }); //Get point collection var pointCollectionVinSpeed = new PointCollection(); var pointCollectionCat = new PointCollection(); //var pointCollectionSocMax = new PointCollection(); //var pointCollectionSocDas = new PointCollection(); List<string> buckets = new List<string>(); // Add string using Add method foreach (DataRow row in dataTable.Rows) { pointCollectionVinSpeed.Add(new Point(Convert.ToDouble(row["TimeInMins"]))); buckets.Add(row["BucketEnd"].ToString()); //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"]))); //pointCollectionSocDas.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCbo_usi_DashSOC_pct"]))); // pointCollection.Add(new Point(DateTime.Parse(row["Time_Occur"].ToString()), Convert.ToDouble(row["SocMin"]))); } //Add data to serie //hcVendas.XAxis.Add(new XAxisItem { title = new Title("Time Buckets"), categories = pointCollectionCat.ToArray() }); //hcFrutas_All.XAxis.Add(new XAxisItem { type = AxisDataType.linear, tickColor = "#ccc", categories = buckets.ToArray(), tickLength = 50, labels = (new Labels() { rotation = -90, step = 1, y = 30 }) }); hcFrutas.XAxis.Add(new XAxisItem { type = AxisDataType.linear, tickColor = "#ccc", categories = buckets.ToArray(), tickLength = 1, title = new Title("Speed") }); var series = new Collection<Serie> { new Serie { name = "% of Time", data = pointCollectionVinSpeed.ToArray(), type = RenderType.column, showInLegend = false } }; //hcVendas.PlotOptions = new PlotOptionsLine { marker = new Marker { enabled = true }, dataLabels = new DataLabels { enabled = true } }; hcFrutas.PlotOptions = new PlotOptionsColumn { groupPadding = 0, pointPadding = 0, shadow = true, borderWidth = 2, borderColor = "#666", dataLabels = new DataLabels { enabled = true } }; //Bind the control hcFrutas.DataSource = series; hcFrutas.DataBind(); }
private void ReportServices_DailyGrab_GenVehicleData_VinSpeedHist(Vehicles v, DateTime dt) { GetChartData gd = new GetChartData(); DataTable dataTable = gd.Dt_DailyGrab_GetVenSpeedHist(v.VinID, dt, Rounding); string mainTitle = string.Format("Vehicle Speed Band - {0}", 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("Time in Mins") }); // hcVendas.XAxis.Add(new XAxisItem { title = new Title("Time Buckets"), categories = new[] { "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" } }); // hcVendas.Tooltip = new ToolTip("Highcharts.dateFormat('%H:%M', this.x) +': '+ this.y"); //Get point collection var pointCollectionVinSpeed = new PointCollection(); var pointCollectionCat = new PointCollection(); //var pointCollectionSocMax = new PointCollection(); //var pointCollectionSocDas = new PointCollection(); List<string> revenues = new List<string>(); // Add string using Add method foreach (DataRow row in dataTable.Rows) { pointCollectionVinSpeed.Add(new Point(Convert.ToDouble(row["TimeInMins"]))); revenues.Add(row["BucketName"].ToString()); //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"]))); //pointCollectionSocDas.Add(new Point(Convert.ToInt64((DateTime.Parse(row["Time_Occur"].ToString()).Subtract(new DateTime(2015, 1, 1))).TotalMilliseconds), Convert.ToDouble(row["PCbo_usi_DashSOC_pct"]))); // pointCollection.Add(new Point(DateTime.Parse(row["Time_Occur"].ToString()), Convert.ToDouble(row["SocMin"]))); } //Add data to serie //hcVendas.XAxis.Add(new XAxisItem { title = new Title("Time Buckets"), categories = pointCollectionCat.ToArray() }); hcVendas.XAxis.Add(new XAxisItem { title = new Title("Time Buckets"), categories = revenues.ToArray(), labels = (new Labels() { rotation = -90, step = 1, y = 20 }) }); var series = new Collection<Serie> { new Serie { name = "VinSpeed", data = pointCollectionVinSpeed.ToArray(), type = RenderType.column } }; series.Add(new Serie { name = "VinSpeed2", data = pointCollectionVinSpeed.ToArray(), type = RenderType.spline }); //hcVendas.PlotOptions = new PlotOptionsLine { marker = new Marker { enabled = true }, dataLabels = new DataLabels { enabled = true } }; //Bind the control hcVendas.DataSource = series; hcVendas.DataBind(); }