public void CheckSeriesDotChart() { var chart = new FlotChart("test"); var series = new FlotSeries(chart); Assert.AreEqual(chart, series.Chart); }
public static string Flot(this HtmlHelper html, string placeholder, System.Action <FlotChart> populateChart) { var chart = new FlotChart(placeholder); populateChart(chart); return(chart.ToJson()); }
// // GET: /Bootstrap/Core/Flot public virtual ActionResult Flot(int?mode) { int dmode = mode.HasValue ? mode.Value : 0; FlotChart chart = m_graphDataGenerator.GetFlotChart(dmode); FlotViewModel model = new FlotViewModel { Chart = chart, DisplayMode = dmode }; return(View(model)); }
public void Test1() { var chart = new FlotChart("test") .AddSeries( options => options.Lines( lines => lines.Fill(true).LineWidth(3)) ) .AddSeries(options => options.Lines(lines => lines.Fill(true).LineWidth(3))) .Options( options => options .Lines( lines => lines .Fill(true) .FillColor("#222222") ) ); string json = chart.ToJson(); }
public void Test1() { var chart = new FlotChart("test") .AddSeries(options => options.Lines(lines => lines.Fill(true).LineWidth(3))) .AddSeries(options => options.Lines(lines => lines.Fill(true).LineWidth(3))) .Options(options => options .Lines(lines => lines .Fill(true) .FillColor("#222222") ) ); string json = chart.ToJson(); }
public static FlotChart GetPageVisitChart(IStatsRepository repository) { var visits = repository.FetchUniqueVisits(null, null).ToList(); var chart = new FlotChart(); var unique = chart.AddSeries("Unique Visitors", new FlotChartLine()); var clicks = chart.AddSeries("Page Clicks", new FlotChartDashed(true, 2)); foreach (var date in visits.Select(v => v.Date).Distinct()) { chart.AddData(unique, date.Value.ToLongDateString(), visits.Where(v => v.Date == date).Count()); chart.AddData(clicks, date.Value.ToLongDateString(), visits.Where(v => v.Date == date).Sum(v => v.Count.HasValue ? v.Count.Value : 0)); } return(chart); }
public static string Flot(this HtmlHelper html, string placeholder, System.Action<FlotChart> populateChart) { var chart = new FlotChart(placeholder); populateChart(chart); return chart.ToJson(); }
public void EmptyChartTest() { var chart = new FlotChart("test"); }
public void BasicChartTest() { var chart = new FlotChart("test"); chart.ToJson(); }
/// <summary> /// Get canned/dummy flot chart /// </summary> /// <param name="mode">Mode for which to get the chart</param> /// <returns>Flot chart</returns> public FlotChart GetFlotChart(int mode) { FlotOptions options = new FlotOptions { xaxis = new JQFlot.SubOptions.AxisOptions { axisLabel = "X axis label", axisLabelColor = "#222222" }, yaxis = new JQFlot.SubOptions.AxisOptions { axisLabel = "Y axis label", axisLabelColor = "#222222" }, grid = new JQFlot.SubOptions.GridOptions { borderWidth = 1 } }; List <FlotSeries> series = new List <FlotSeries>(); FlotSeries serie = null; switch (mode) { case 6: serie = new FlotSeries { label = "Sample Line Graph", data = GraphSampleData, lines = new LineGraph { show = true } }; series.Add(serie); options = new FlotOptions { grid = new JQFlot.SubOptions.GridOptions { borderWidth = 1 }, xaxis = new JQFlot.SubOptions.AxisOptions { tickDecimals = 2, tickFormatter = new JsFunc { ParameterNames = new string[] { "val", "axis" }, Body = "return val.toFixed(axis.tickDecimals);" }, axisLabel = "X Axis - Ticks to two decimals", axisLabelColor = "#222222" }, yaxis = new JQFlot.SubOptions.AxisOptions { axisLabel = "Y Axis Label", axisLabelColor = "#222222" } }; break; case 5: goto default; case 4: series = Enumerable.Range(1, 5).Select(f => new FlotSeries { label = "Serie" + f.ToString(CultureInfo.InvariantCulture), data = m_rand.NextDouble() * 100 }).ToList(); options = new FlotOptions { series = new JQFlot.SubOptions.SeriesOptions { pie = new PieGraph { show = true } } }; break; case 3: serie = new FlotSeries { label = "Sample Bar Graph", data = GraphSampleData, bars = new BarGraph { show = true } }; series.Add(serie); break; case 2: serie = new FlotSeries { label = "Sample Curved Line Graph", data = GraphSampleData, curvedLines = new CurvedLineGraph { show = true } }; options = new FlotOptions { xaxis = new JQFlot.SubOptions.AxisOptions { axisLabel = "X axis label", axisLabelColor = "#222222" }, yaxis = new AxisOptions { axisLabel = "Y axis label", axisLabelColor = "#222222" }, grid = new GridOptions { borderWidth = 1 }, series = new SeriesOptions { curvedLines = new CurvedLineOptions { active = true } } }; series.Add(serie); break; case 1: serie = new FlotSeries { label = "Sample Dashed Line Graph", data = GraphSampleData, dashes = new DashedLineGraph { show = true } }; series.Add(serie); break; case 0: default: serie = new FlotSeries { label = "Sample Line Graph", data = GraphSampleData, lines = new LineGraph { show = true } }; series.Add(serie); break; } FlotChart chart = new FlotChart { chartOptions = options, chartSeries = series.ToArray() }; return(chart); }