/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int count = 20; int length = titles.Length; Random r = new Random(); for (int i = 0; i < length; i++) { double[] xValues = new double[count]; double[] yValues = new double[count]; for (int k = 0; k < count; k++) { xValues[k] = k + r.Next() % 10; yValues[k] = k * 2 + r.Next() % 10; } x.Add(xValues); values.Add(yValues); } int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.MAGENTA, Color.LTGRAY, Color.GREEN }; PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.DIAMOND, PointStyle.TRIANGLE, PointStyle.SQUARE, PointStyle.CIRCLE }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.GRAY, Color.LTGRAY); renderer.XLabels = 10; renderer.YLabels = 10; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.getSeriesRendererAt(i)).FillPoints = true; } return(ChartFactory.getScatterChartIntent(context, buildDataset(titles, x, values), renderer)); }
public static void Main(string[] args) { IChartable chart = ChartFactory.GetChart("pie"); chart.Display(); Console.ReadKey(); }
public static void Main(string[] args) { // Getting the time series TimeSeries series = CsvTradesLoader.loadBitstampSeries(); // Building the trading strategy Strategy strategy = MovingMomentumStrategy.buildStrategy(series); /// <summary> /// Building chart datasets /// </summary> TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(buildChartTimeSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); /// <summary> /// Creating the chart /// </summary> JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", dataset, true, true, false); // generate URLs? - generate tooltips? - create legend? - data - y-axis label - x-axis label - title XYPlot plot = (XYPlot)chart.Plot; DateAxis axis = (DateAxis)plot.DomainAxis; axis.DateFormatOverride = new SimpleDateFormat("MM-dd HH:mm"); /// <summary> /// Running the strategy and adding the buy and sell signals to plot /// </summary> addBuySellSignals(series, strategy, plot); /// <summary> /// Displaying the chart /// </summary> displayChart(chart); }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "sin", "cos" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int step = 4; int count = 360 / step + 1; x.Add(new double[count]); x.Add(new double[count]); double[] sinValues = new double[count]; double[] cosValues = new double[count]; values.Add(sinValues); values.Add(cosValues); for (int i = 0; i < count; i++) { int angle = i * step; x[0][i] = angle; x[1][i] = angle; double rAngle = Math.Tan(angle); sinValues[i] = Math.Sin(rAngle); cosValues[i] = Math.Cos(rAngle); } int[] colors = new int[] { Color.Blue, Color.Cyan }; PointStyle[] styles = new PointStyle[] { PointStyle.Point, PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.Gray, Color.LightGray); renderer.XLabels = 20; renderer.YLabels = 10; return(ChartFactory.GetLineChartIntent(context, BuildDataset(titles, x, values), renderer)); }
public ApproachVolumeChart(ApproachVolumeOptions options, ApproachVolume approachVolume, Models.DirectionType direction1, Models.DirectionType direction2) { MetricInfo = new MetricInfo(); Options = options; Chart = ChartFactory.CreateApproachVolumeChart(options, approachVolume); AddDataToChart(approachVolume, options); }
protected override void OnResume() { base.OnResume(); if (mChartView == null) { LinearLayout layout = FindViewById <LinearLayout>(Resource.Id.chart); mChartView = ChartFactory.GetLineChartView(this, mDataset, mRenderer); // enable the chart click events mRenderer.ClickEnabled = true; mRenderer.SelectableBuffer = 10; mChartView.SetOnClickListener(new OnClickListenerAnonymousInnerClassHelper3(this)); layout.AddView ( mChartView, new Android.Widget.LinearLayout.LayoutParams ( Android.Widget.LinearLayout.LayoutParams.FillParent, Android.Widget.LinearLayout.LayoutParams.FillParent) ); bool enabled = mDataset.SeriesCount > 0; SeriesWidgetsEnabled = enabled; } else { mChartView.Repaint(); } }
private ChartDataModel GetChartFromTimes(List <TimeDTO> times) { var factory = new ChartFactory(); var chart = factory.CreateChartDataModelDiscipline(times); return(chart); }
protected void Page_Load(object sender, EventArgs e) { ChartSession cs = SessionManager.ChartSession; if (!cs.IsEmpty()) { LineChartConfig cfg = cs.ChartConfig as LineChartConfig; if (cs.Name == SessionChartName.P2Hour || cs.Name == SessionChartName.PDuringWL || cs.Name == SessionChartName.PDuringFlux || cs.Name == SessionChartName.PDuringAmount) { CreateLineConfig(cfg, cs.DataSource); //LineChartConfig cfg = Create(cs.DataSource); } //if (cs.Name == SessionChartName.PDuringWL) //{ // LineChartConfig cfg = cs.ChartConfig as LineChartConfig; // CreateLineConfig(cfg, cs.DataSource); //} //if (cs.Name == "...") //{ //} ChartFactory f = new ChartFactory(); OpenFlashChart.OpenFlashChart chart = f.Create(cs.DataSource as DataTable, cfg); Response.Write(chart.ToString()); } }
protected override void OnResume() { base.OnResume(); if (mChartView == null) { LinearLayout layout = FindViewById <LinearLayout>(Resource.Id.chart); mChartView = ChartFactory.GetPieChartView(this, mSeries, mRenderer); mRenderer.ClickEnabled = true; mChartView.Click += (e, s) => { SeriesSelection seriesSelection = mChartView.CurrentSeriesAndPoint; if (seriesSelection == null) { Toast.MakeText(this, "No chart element selected", ToastLength.Short).Show(); } else { for (int i = 0; i < mSeries.ItemCount; i++) { mRenderer.GetSeriesRendererAt(i).Highlighted = (i == seriesSelection.PointIndex); } mChartView.Repaint(); Toast.MakeText(this, "Chart data point index " + seriesSelection.PointIndex + " selected " + "point value=" + seriesSelection.Value, ToastLength.Short).Show(); } }; layout.AddView(mChartView, new Android.Views.ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); } else { mChartView.Repaint(); } }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "2007", "2008" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500 }); values.Add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000 }); int[] colors = new int[] { Color.CYAN, Color.BLUE }; XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); renderer.Orientation = XYMultipleSeriesRenderer.Orientation.VERTICAL; setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5, 12.5, 0, 24000, Color.GRAY, Color.LTGRAY); renderer.XLabels = 1; renderer.YLabels = 10; renderer.addXTextLabel(1, "Jan"); renderer.addXTextLabel(3, "Mar"); renderer.addXTextLabel(5, "May"); renderer.addXTextLabel(7, "Jul"); renderer.addXTextLabel(10, "Oct"); renderer.addXTextLabel(12, "Dec"); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { SimpleSeriesRenderer seriesRenderer = renderer.getSeriesRendererAt(i); seriesRenderer.DisplayChartValues = true; } return(ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer, Type.DEFAULT)); }
/// <summary> /// Generates a bar chart displaying the status of the tickets matching the specified filter criteria /// </summary> /// <param name="categories"></param> /// <param name="ticketStatuses"></param> /// <param name="severity"></param> /// <param name="displayLegend"></param> /// <returns></returns> protected async Task GenerateTicketStatusChartAsync(string categories, string ticketStatuses, string severity, bool displayLegend) { var ticketList = await GetTicketsAsync(categories, ticketStatuses, severity); var title = (await GetSysParam(1003)).Value; var scaleLabel = (await GetSysParam(1004)).Value; var data = new List <BarChartValue>(); var ticketCategories = ticketList .Select(x => x.Category.Id) .Distinct() .ToList(); foreach (var categoryId in ticketCategories) { var count = ticketList .Where(x => x.Category.Id.Equals(categoryId)) .Count(); var category = await _context.Categories .Where(x => x.Id.Equals(categoryId)) .FirstOrDefaultAsync(); data.Add(new BarChartValue() { Group = scaleLabel, Label = category.DisplayName, Value = count }); } var chart = ChartFactory.GetBarChart(data, title, scaleLabel, ChartFactory.SortType.ByValueDescending, displayLegend); ViewBag.StatusChart = chart; }
protected virtual void GetTimeOfDayCharts() { Chart chart; switch (SelectedSeries) { case SeriesType.Signal: chart = ChartFactory.CreateTimeXIntYChart(this, Signals); GetTimeOfDayXAxisSignalSeriesChart(Signals, chart); break; case SeriesType.Route: chart = ChartFactory.CreateTimeXIntYChart(this, Signals); GetTimeOfDayXAxisRouteSeriesChart(Signals, chart); break; default: throw new Exception("Invalid X-Axis Series Combination"); } if (ShowEventCount) { SetTimeOfDayAxisRouteSeriesForEventCount(Signals, chart); } SaveChartImage(chart); }
protected override void OnResume() { base.OnResume(); if (mChartView == null) { LinearLayout layout = FindViewById <LinearLayout>(Resource.Id.chart); mChartView = ChartFactory.GetLineChartView(this, mDataset, mRenderer); mRenderer.ClickEnabled = true; mRenderer.SelectableBuffer = 10; mChartView.Click += (e, s) => { SeriesSelection seriesSelection = mChartView.CurrentSeriesAndPoint; if (seriesSelection == null) { Toast.MakeText(this, "No chart element", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Chart element in series index " + seriesSelection.SeriesIndex + " data point index " + seriesSelection.PointIndex + " was clicked" + " closest point value X=" + seriesSelection.XValue + ",Y=" + seriesSelection.Value, ToastLength.Short).Show(); } }; layout.AddView(mChartView, new Android.Views.ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); bool enabled = mDataset.SeriesCount > 0; SetSeriesWidgetsEnabled(enabled); } else { mChartView.Repaint(); } }
protected internal override void onResume() { base.onResume(); if (mChartView == null) { LinearLayout layout = (LinearLayout)findViewById(R.id.chart); // mChartView = ChartFactory.getLineChartView(this, mDataset, mRenderer); // mChartView = ChartFactory.getBarChartView(this, mDataset, mRenderer, // Type.DEFAULT); mChartView = ChartFactory.getScatterChartView(this, mDataset, mRenderer); // enable the chart click events mRenderer.ClickEnabled = true; mRenderer.SelectableBuffer = 100; mChartView.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this); // an example of handling the zoom events on the chart mChartView.addZoomListener(new ZoomListenerAnonymousInnerClassHelper(this), true, true); // an example of handling the pan events on the chart mChartView.addPanListener(new PanListenerAnonymousInnerClassHelper(this)); layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); bool enabled = mDataset.SeriesCount > 0; SeriesWidgetsEnabled = enabled; } else { mChartView.repaint(); } }
/// <summary> /// Executes the chart demo. </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { CategorySeries category = new CategorySeries("Weight indic"); category.add("Current", 75); category.add("Minimum", 65); category.add("Maximum", 90); DialRenderer renderer = new DialRenderer(); renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.Margins = new int[] { 20, 30, 15, 0 }; SimpleSeriesRenderer r = new SimpleSeriesRenderer(); r.Color = Color.BLUE; renderer.addSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.Color = Color.rgb(0, 150, 0); renderer.addSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.Color = Color.GREEN; renderer.addSeriesRenderer(r); renderer.LabelsTextSize = 10; renderer.LabelsColor = Color.WHITE; renderer.ShowLabels = true; renderer.VisualTypes = new DialRenderer.Type[] { DialRenderer.Type.ARROW, DialRenderer.Type.NEEDLE, DialRenderer.Type.NEEDLE }; renderer.MinValue = 0; renderer.MaxValue = 150; return(ChartFactory.getDialChartIntent(context, category, renderer, "Weight indicator")); }
/// <summary> /// Executes the chart demo. </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "sin", "cos" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int step = 4; int count = 360 / step + 1; x.Add(new double[count]); x.Add(new double[count]); double[] sinValues = new double[count]; double[] cosValues = new double[count]; values.Add(sinValues); values.Add(cosValues); for (int i = 0; i < count; i++) { int angle = i * step; x[0][i] = angle; x[1][i] = angle; double rAngle = Math.toRadians(angle); sinValues[i] = Math.Sin(rAngle); cosValues[i] = Math.Cos(rAngle); } int[] colors = new int[] { Color.BLUE, Color.CYAN }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.GRAY, Color.LTGRAY); renderer.XLabels = 20; renderer.YLabels = 10; return(ChartFactory.getLineChartIntent(context, buildDataset(titles, x, values), renderer)); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "2007", "2008" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500 }); values.Add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000 }); int[] colors = new int[] { Color.Cyan, Color.Blue }; XYMultipleSeriesRenderer renderer = BuildBarRenderer(colors); renderer.SetOrientation(XYMultipleSeriesRenderer.Orientation.Vertical); SetChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5, 12.5, 0, 24000, Color.Gray, Color.LightGray); renderer.XLabels = 1; renderer.YLabels = 10; renderer.AddXTextLabel(1, "Jan"); renderer.AddXTextLabel(3, "Mar"); renderer.AddXTextLabel(5, "May"); renderer.AddXTextLabel(7, "Jul"); renderer.AddXTextLabel(10, "Oct"); renderer.AddXTextLabel(12, "Dec"); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { SimpleSeriesRenderer seriesRenderer = renderer.GetSeriesRendererAt(i); seriesRenderer.DisplayChartValues = true; } return(ChartFactory.GetBarChartIntent(context, BuildBarDataset(titles, values), renderer, global::AChartEngine.Charts.BarChart.Type.Default)); }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int count = 20; int length = titles.Length; Random r = new Random(); for (int i = 0; i < length; i++) { double[] xValues = new double[count]; double[] yValues = new double[count]; for (int k = 0; k < count; k++) { xValues[k] = k + r.Next() % 10; yValues[k] = k * 2 + r.Next() % 10; } x.Add(xValues); values.Add(yValues); } int[] colors = new int[] { Color.Blue, Color.Cyan, Color.Magenta, Color.LightGray, Color.Green }; PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.Diamond, PointStyle.Triangle, PointStyle.Square, PointStyle.Circle }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.Gray, Color.LightGray); renderer.XLabels = 10; renderer.YLabels = 10; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.GetSeriesRendererAt(i)).FillPoints = true; } return(ChartFactory.GetScatterChartIntent(context, BuildDataset(titles, x, values), renderer)); }
protected override void GetSignalCharts() { Chart chart; switch (SelectedSeries) { case SeriesType.PhaseNumber: chart = ChartFactory.CreateStringXIntYChart(this); GetSignalsXAxisPhaseNumberSeriesChart(Signals, chart); break; case SeriesType.Direction: chart = ChartFactory.CreateStringXIntYChart(this); GetSignalsXAxisDirectionSeriesChart(Signals, chart); break; case SeriesType.Signal: chart = ChartFactory.CreateStringXIntYChart(this); GetSignalsXAxisSignalSeriesChart(Signals, chart); break; default: throw new Exception("Invalid X-Axis Series Combination"); } if (ShowEventCount) { SetSignalsXAxisSignalSeriesForEventCount(Signals, chart); } SaveChartImage(chart); }
private void GetDetectorCharts() { Chart chart; switch (SelectedSeries) { case SeriesType.PhaseNumber: foreach (var signal in Signals) { chart = ChartFactory.CreateStringXIntYChart(this); GetApproachXAxisChart(signal, chart); SaveChartImage(chart); } break; case SeriesType.Detector: foreach (var signal in Signals) { chart = ChartFactory.CreateStringXIntYChart(this); GetApproachXAxisDetectorSeriesChart(signal, chart); SaveChartImage(chart); } break; default: throw new Exception("Invalid X-Axis Series Combination"); } }
protected override void OnListItemClick(ListView l, View v, int position, long id) { base.OnListItemClick(l, v, position, id); switch (position) { case 0: Intent intent = ChartFactory.GetLineChartIntent(this, DemoDataset, DemoRenderer); StartActivity(intent); break; case 1: intent = ChartFactory.GetScatterChartIntent(this, DemoDataset, DemoRenderer); StartActivity(intent); break; case 2: intent = ChartFactory.GetTimeChartIntent(this, DateDemoDataset, DemoRenderer, null); StartActivity(intent); break; case 3: XYMultipleSeriesRenderer renderer = BarDemoRenderer; ChartSettings = renderer; intent = ChartFactory.GetBarChartIntent(this, BarDemoDataset, renderer, BarChart.Type.Default); StartActivity(intent); break; } }
/// <summary> /// Create the chart using the data. /// </summary> private JFreeChart createChart(DefaultTableXYDataset dataset) { string xlabel = "Surface Area (ACRE)"; if (__type.Equals("Seepage")) { xlabel = "Seepage (AF/M)"; } JFreeChart chart = ChartFactory.createXYLineChart("Reservoir Content/" + __type + " Curve", xlabel, "Content (ACFT)", dataset, PlotOrientation.VERTICAL, false, true, false); chart.addSubtitle(new TextTitle(__res.getID() + " (" + __res.getName() + ")")); //TextTitle source = new TextTitle("Source: rgtTW.res"); //source.setFont(new Font("SansSerif", Font.PLAIN, 10)); //source.setPosition(RectangleEdge.BOTTOM); //source.setHorizontalAlignment(HorizontalAlignment.RIGHT); //chart.addSubtitle(source); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot)chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return(chart); }
public override Android.Content.Intent Execute(Android.Content.Context context) { CategorySeries category = new CategorySeries("Weight indic"); category.Add("Current", 75); category.Add("Minimum", 65); category.Add("Maximum", 90); DialRenderer renderer = new DialRenderer(); renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.SetMargins(new int[] { 20, 30, 15, 0 }); SimpleSeriesRenderer r = new SimpleSeriesRenderer(); r.Color = Color.Blue; renderer.AddSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.Color = Color.Rgb(0, 150, 0); renderer.AddSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.Color = Color.Green; renderer.AddSeriesRenderer(r); renderer.LabelsTextSize = 10; renderer.LabelsColor = Color.White; renderer.ShowLabels = true; renderer.SetVisualTypes(new DialRenderer.Type[] { DialRenderer.Type.Arrow, DialRenderer.Type.Needle, DialRenderer.Type.Needle }); renderer.MinValue = 0; renderer.MaxValue = 150; return(ChartFactory.GetDialChartIntent(context, category, renderer, "Weight indicator")); }
// GET: Chart public ActionResult View(int w, int h, string t, int f, string xn, string yn, string s1n, string s1t, string s1xv, string s1yv) { // w = width // h = height // t = title // f = predefined format // xn = x-axis name // yn = y-axis name // s1n = series 1 Name // s1xv = series 1 x Values // s1yv = series 1 y Values var xValues = s1xv.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var yValues = s1yv.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var chart = ChartFactory.CreateTestChart(w, h, t, f, xn, yn, s1n, s1t, xValues, yValues); using (var memoryStream = new MemoryStream()) { chart.SaveImage(memoryStream, ChartImageFormat.Png); memoryStream.Seek(0, SeekOrigin.Begin); return File(memoryStream.ToArray(), "image/png", "mychart.png"); } }
protected override void StartTest() { { if (CanStartTest()) { DisplayTempMessage("Test in process...", GOOD_MESSAGE_BRUSH, 0); FullyReversedTorqueTest test = Session.TestTemplate.TestInstance() as FullyReversedTorqueTest; test.Operator = Session.BenchOperator; test.WorkOrder = Session.WorkId; TestBench.Singleton.LoadTest(test); TestBench.Singleton.BeginCurrentTest(); ChartFactory.CreateFullyReversedChart(TorqueAngleChart, (test as FullyReversedTorqueTest).MinTorque, (test as FullyReversedTorqueTest).MaxTorque); ClearTestData(); // reevalutate all commands can execute. StartTestCommand.RaiseCanExecuteChanged(); ExitProgamCommand.RaiseCanExecuteChanged(); StopTestCommand.RaiseCanExecuteChanged(); } } }
/// <summary> /// Generates a pie chart describing the tickets which were created matching the filter criteria provided /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="categories"></param> /// <param name="severity"></param> /// <param name="displayLegend"></param> /// <returns></returns> protected async Task GenerateRequestTypeChartAsync(DateTime?startTime, DateTime?endTime, string categories, string severity, bool displayLegend) { var ticketList = await GetActivityListAsync(startTime, endTime, categories, null, severity); var dataSeries = new Dictionary <string, double?>(); var ticketCategories = ticketList.Select(x => x.Category.DisplayName).Distinct().ToList(); foreach (var category in ticketCategories) { var tickets = ticketList .Where(x => x.Category.DisplayName.Equals(category) && (x.DateSubmitted >= startTime) && (x.DateSubmitted <= endTime)) .ToList(); var count = tickets.Count(); if (count > 0) { dataSeries.Add(category, count); } } ViewBag.StartDate = startTime.Value.Date.ToString("yyyy-MM-dd"); ViewBag.EndDate = endTime.Value.Date.ToString("yyyy-MM-dd");; var title = (await GetSysParam(1007)).Value; var chart = ChartFactory.GetPieChart(dataSeries, title, ChartFactory.SortType.ByValueDescending, displayLegend); ViewBag.RequestChart = chart; }
private void CreateLegend() { var dummychart = new Chart(); var chartarea1 = new ChartArea(); ChartFactory.SetImageProperties(dummychart); dummychart.BorderlineDashStyle = ChartDashStyle.Dot; var PedActivity = new Series(); var GapoutSeries = new Series(); var MaxOutSeries = new Series(); var ForceOffSeries = new Series(); var UnknownSeries = new Series(); PedActivity.Name = "Ped Activity"; GapoutSeries.Name = "Gap Out"; MaxOutSeries.Name = "Max Out"; ForceOffSeries.Name = "Force Off"; UnknownSeries.Name = "Unknown"; PedActivity.MarkerStyle = MarkerStyle.Cross; GapoutSeries.MarkerStyle = MarkerStyle.Circle; MaxOutSeries.MarkerStyle = MarkerStyle.Circle; ForceOffSeries.MarkerStyle = MarkerStyle.Circle; UnknownSeries.MarkerStyle = MarkerStyle.Circle; GapoutSeries.Color = Color.OliveDrab; PedActivity.Color = Color.DarkGoldenrod; MaxOutSeries.Color = Color.Red; ForceOffSeries.Color = Color.MediumBlue; UnknownSeries.Color = Color.FromArgb(255, 255, 0); dummychart.Series.Add(GapoutSeries); dummychart.Series.Add(MaxOutSeries); dummychart.Series.Add(ForceOffSeries); dummychart.Series.Add(UnknownSeries); dummychart.Series.Add(PedActivity); dummychart.ChartAreas.Add(chartarea1); var dummychartLegend = new Legend(); dummychartLegend.Name = "DummyLegend"; dummychartLegend.IsDockedInsideChartArea = true; dummychartLegend.Title = "Chart Legend"; dummychartLegend.Docking = Docking.Top; dummychartLegend.Alignment = StringAlignment.Center; dummychart.Legends.Add(dummychartLegend); dummychart.Height = 100; dummychart.SaveImage(MetricFileLocation + "PPTLegend.jpeg", ChartImageFormat.Jpeg); ReturnList.Add(MetricWebPath + "PPTLegend.jpeg"); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Sales growth January 1995 to December 2000" }; IList <DateTime[]> dates = new List <DateTime[]>(); IList <double[]> values = new List <double[]>(); DateTime[] dateValues = new DateTime[] { new DateTime(95, 0, 1), new DateTime(95, 3, 1), new DateTime(95, 6, 1), new DateTime(95, 9, 1), new DateTime(96, 0, 1), new DateTime(96, 3, 1), new DateTime(96, 6, 1), new DateTime(96, 9, 1), new DateTime(97, 0, 1), new DateTime(97, 3, 1), new DateTime(97, 6, 1), new DateTime(97, 9, 1), new DateTime(98, 0, 1), new DateTime(98, 3, 1), new DateTime(98, 6, 1), new DateTime(98, 9, 1), new DateTime(99, 0, 1), new DateTime(99, 3, 1), new DateTime(99, 6, 1), new DateTime(99, 9, 1), new DateTime(100, 0, 1), new DateTime(100, 3, 1), new DateTime(100, 6, 1), new DateTime(100, 9, 1), new DateTime(100, 11, 1) }; dates.Add(dateValues); values.Add(new double[] { 4.9, 5.3, 3.2, 4.5, 6.5, 4.7, 5.8, 4.3, 4, 2.3, -0.5, -2.9, 3.2, 5.5, 4.6, 9.4, 4.3, 1.2, 0, 0.4, 4.5, 3.4, 4.5, 4.3, 4 }); int[] colors = new int[] { Color.BLUE }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Sales growth", "Date", "%", dateValues[0].Ticks, dateValues[dateValues.Length - 1].Ticks, -4, 11, Color.GRAY, Color.LTGRAY); renderer.YLabels = 10; renderer.XRoundedLabels = false; XYSeriesRenderer xyRenderer = (XYSeriesRenderer)renderer.getSeriesRendererAt(0); XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE); fill.Color = Color.GREEN; xyRenderer.addFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_BELOW); fill.Color = Color.MAGENTA; xyRenderer.addFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE); fill.Color = Color.argb(255, 0, 200, 100); fill.FillRange = new int[] { 10, 19 }; xyRenderer.addFillOutsideLine(fill); return(ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values), renderer, "MMM yyyy")); }
protected override void GetTimeOfDayCharts() { switch (SelectedSeries) { case SeriesType.PhaseNumber: foreach (var signal in Signals) { Chart phaseChart = ChartFactory.CreateTimeXIntYChart(this, new List <Models.Signal> { signal }); GetTimeOfDayXAxisApproachSeriesChart(signal, phaseChart); if (ShowEventCount) { SetTimeofDayAxisSignalSeriesForEventCount(signal, phaseChart); } SaveChartImage(phaseChart); } break; case SeriesType.Direction: foreach (var signal in Signals) { var signals = new List <Models.Signal> { signal }; Chart directionChart = ChartFactory.CreateTimeXIntYChart(this, signals); GetTimeOfDayXAxisDirectionSeriesChart(signal, directionChart); if (ShowEventCount) { SetTimeofDayAxisSignalSeriesForEventCount(signal, directionChart); } SaveChartImage(directionChart); } break; case SeriesType.Signal: Chart signalChart = ChartFactory.CreateTimeXIntYChart(this, Signals); GetTimeOfDayXAxisSignalSeriesChart(Signals, signalChart); if (ShowEventCount) { SetTimeOfDayAxisRouteSeriesForEventCount(Signals, signalChart); } SaveChartImage(signalChart); break; case SeriesType.Route: Chart RouteChart = ChartFactory.CreateTimeXIntYChart(this, Signals); GetTimeOfDayXAxisRouteSeriesChart(Signals, RouteChart); if (ShowEventCount) { SetTimeOfDayAxisRouteSeriesForEventCount(Signals, RouteChart); } SaveChartImage(RouteChart); break; default: throw new Exception("Invalid X-Axis Series Combination"); } }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "Sales growth January 1995 to December 2000" }; IList <Java.Util.Date[]> dates = new List <Java.Util.Date[]>(); IList <double[]> values = new List <double[]>(); Java.Util.Date[] dateValues = new Java.Util.Date[] { new Java.Util.Date(95, 0, 1), new Java.Util.Date(95, 3, 1), new Java.Util.Date(95, 6, 1), new Java.Util.Date(95, 9, 1), new Java.Util.Date(96, 0, 1), new Java.Util.Date(96, 3, 1), new Java.Util.Date(96, 6, 1), new Java.Util.Date(96, 9, 1), new Java.Util.Date(97, 0, 1), new Java.Util.Date(97, 3, 1), new Java.Util.Date(97, 6, 1), new Java.Util.Date(97, 9, 1), new Java.Util.Date(98, 0, 1), new Java.Util.Date(98, 3, 1), new Java.Util.Date(98, 6, 1), new Java.Util.Date(98, 9, 1), new Java.Util.Date(99, 0, 1), new Java.Util.Date(99, 3, 1), new Java.Util.Date(99, 6, 1), new Java.Util.Date(99, 9, 1), new Java.Util.Date(100, 0, 1), new Java.Util.Date(100, 3, 1), new Java.Util.Date(100, 6, 1), new Java.Util.Date(100, 9, 1), new Java.Util.Date(100, 11, 1) }; dates.Add(dateValues); values.Add(new double[] { 4.9, 5.3, 3.2, 4.5, 6.5, 4.7, 5.8, 4.3, 4, 2.3, -0.5, -2.9, 3.2, 5.5, 4.6, 9.4, 4.3, 1.2, 0, 0.4, 4.5, 3.4, 4.5, 4.3, 4 }); int[] colors = new int[] { Color.Blue }; PointStyle[] styles = new PointStyle[] { PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Sales growth", "Date", "%", dateValues[0].Time, dateValues[dateValues.Length - 1].Time, -4, 11, Color.Gray, Color.LightGray); renderer.YLabels = 10; renderer.XRoundedLabels = false; XYSeriesRenderer xyRenderer = (XYSeriesRenderer)renderer.GetSeriesRendererAt(0); XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsAbove); fill.Color = Color.Green; xyRenderer.AddFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsBelow); fill.Color = Color.Magenta; xyRenderer.AddFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsAbove); fill.Color = Color.Argb(255, 0, 200, 100); fill.SetFillRange(new int[] { 10, 19 }); xyRenderer.AddFillOutsideLine(fill); return(ChartFactory.GetTimeChartIntent(context, BuildDateDataset(titles, dates, values), renderer, "MMM yyyy")); }
protected void Page_Load(object sender, EventArgs e) { int i = 2 - 1; ChartSession cs = SessionManager.ChartSessionManager.GetChartSession(i); LineChartConfig cfg = cs.ChartConfig as LineChartConfig; ChartFactory f = new ChartFactory(); OpenFlashChart.OpenFlashChart chart = f.Create(cs.DataSource as DataTable, cfg); Response.Write(chart.ToString()); }
/// <summary> /// /// </summary> private void f2(DataTable tbl) { LineChartConfig cfg = new LineChartConfig( "use line chart config", "x title(X轴承)", "Y title(Y轴承)", "DT"); //cfg.XSegmentCount LineDataConfig ldc = new LineDataConfig("line1", "wl1","#00ff00"); LineDataConfig ldc2 = new LineDataConfig("line2", "wl2", "#0000ff"); //ldc2.Name = "line2"; //ldc2.DataFieldName = "wl2"; cfg.LineDataConfigCollection.Add(ldc); cfg.LineDataConfigCollection.Add(ldc2); OpenFlashChart.OpenFlashChart chart = new ChartFactory().Create(tbl, cfg); Response.Write(chart.ToString()); }