public void GoogleChartTest() { var logset = new SharePointLogSet(new string[] { SharePointLogFileTests.good_SPTestFile }); var chart = new GoogleChart(logset.GetLogSetMetrics()); Assert.IsTrue(chart.HTML.Length > 0); }
public IActionResult ExampleMvc() { ChartOptions opts = new ChartOptions(); opts.ChartType = PlotChartType.Line; opts.Resolution = PlotResolution.None; opts.Showgrid = true; opts.XAxis.Datatype = AxisDataType.Numeric; opts.YAxis.Datatype = AxisDataType.Numeric; GoogleChart chart = new GoogleChart(); chart.ChartDefinition = opts; chart.CurveData.Add("My Curve 1", new List <PlotPoint> { new PlotPoint(0, 20), new PlotPoint(1, 30), new PlotPoint(2, 40), new PlotPoint(3, 35), new PlotPoint(4, 15), new PlotPoint(5, 25) }); chart.CurveData.Add("My Curve 2", new List <PlotPoint> { new PlotPoint(0, 12), new PlotPoint(1, 13), new PlotPoint(2, 18), new PlotPoint(3, 22), new PlotPoint(4, 42), new PlotPoint(5, 23) }); return(View(chart)); }
/// <summary> /// Generates metrics and sets browser window contents /// </summary> private void LoadMetrics() { SetUserWaitMessage(); Task.Factory.StartNew(() => { return(_logset.GetLogSetMetrics()); }) .ContinueWith((t) => { if (t.Result != null) { var chart = new GoogleChart(t.Result); this.Left -= 200; this.Top -= 200; SetBrowserContents(chart.HTML, web.Height, web.Width); lblHeading.Content = string.Concat("Total Entries: ", _logset.Entries.Count); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
protected static void UpdateChart(TelemetryDataTable tdt, Controls_GoogleChart gcData, FlightData fd, string PathLatLongArrayID, ListItem xAxis, ListItem yAxis1, ListItem yAxis2, out decimal max, out decimal min, out decimal max2, out decimal min2) { max = decimal.MinValue; min = decimal.MaxValue; max2 = decimal.MinValue; min2 = decimal.MaxValue; if (tdt == null) { return; } if (gcData == null) { throw new ArgumentNullException(nameof(gcData)); } if (yAxis1 == null || yAxis2 == null || xAxis == null) { gcData.Visible = false; return; } gcData.XLabel = xAxis.Text; gcData.YLabel = yAxis1.Text; gcData.Y2Label = yAxis2.Text; gcData.Clear(); gcData.XDataType = GoogleChart.GoogleTypeFromKnownColumnType(KnownColumn.GetKnownColumn(xAxis.Value).Type); gcData.YDataType = GoogleChart.GoogleTypeFromKnownColumnType(KnownColumn.GetKnownColumn(yAxis1.Value).Type); gcData.Y2DataType = GoogleChart.GoogleTypeFromKnownColumnType(KnownColumn.GetKnownColumn(yAxis2.Value).Type); if (fd == null) { throw new ArgumentNullException(nameof(fd)); } if (fd.HasLatLongInfo) { gcData.ClickHandlerJS = String.Format(CultureInfo.InvariantCulture, "dropPin({0}[selectedItem.row], xvalue + ': ' + ((selectedItem.column == 1) ? '{1}' : '{2}') + ' = ' + value);", PathLatLongArrayID, yAxis1, yAxis2); } foreach (DataRow dr in tdt.Rows) { gcData.XVals.Add(dr[xAxis.Value]); if (!String.IsNullOrEmpty(yAxis1.Value)) { object o = dr[yAxis1.Value]; gcData.YVals.Add(o); if (gcData.YDataType == GoogleColumnDataType.number) { decimal d = Convert.ToDecimal(o, CultureInfo.InvariantCulture); max = Math.Max(max, d); min = Math.Min(min, d); } } if (yAxis2.Value.Length > 0 && yAxis2 != yAxis1) { object o = dr[yAxis2.Value]; gcData.Y2Vals.Add(o); if (gcData.Y2DataType == GoogleColumnDataType.number) { decimal d = Convert.ToDecimal(o, CultureInfo.InvariantCulture); max2 = Math.Max(max2, d); min2 = Math.Min(min2, d); } } } gcData.TickSpacing = 1; // Math.Max(1, m_fd.Data.Rows.Count / 20); }