/// <summary>
 /// Applies only to polar charts and angular gauges. This configuration object holds general options for the combined X and Y axes set. Each xAxis or yAxis can reference the pane by index.
 /// </summary>
 /// <param name="pane"></param>
 /// <returns></returns>
 public Highcharts SetPane(Pane[] paneArray)
 {
     _PaneArray = paneArray;
     return this;
 }
 public Highcharts SetPane(Pane pane)
 {
     _Pane = pane;
     return this;
 }
Example #3
0
        public string WeightYearProgressNet()
        {
            var startWeight = pedometerCalcService.GetStartWeight(DateTime.Now.Year);
            const int goalWeight = 144;
            var currentWeight = pedometerCalcService.GetRecentWeight();
            var goalLoss = startWeight - goalWeight;
            var actualLoss = Math.Round(startWeight - currentWeight, 1);
            var expectedPct = (DateTime.Now.DayOfYear / 365.0);
            var expectedLoss = Math.Round(expectedPct * goalLoss, 1);

            var highchart = new Highcharts("weightloss");
            var chart = new Chart()
                {
                    Type = ChartTypes.Gauge
                };
            highchart.InitChart(chart);
            highchart.SetTitle(new Title{Text = "Weight Loss " + Math.Round(currentWeight,1)});
            var series = new Series {Data = new Data(new object[] {actualLoss})};
            highchart.SetSeries(series);
            var pane = new Pane
                {
                    Background = new[]
                        {
                            new BackgroundObject
                                {
                                    InnerRadius = new PercentageOrPixel(60, true),
                                    OuterRadius = new PercentageOrPixel(100, true)
                                }
                        },
                        StartAngle = 0,
                        EndAngle = 360
                };
            highchart.SetPane(pane);
            var yaxis = new YAxis
                {
                    Min = 0,
                    Max = goalLoss,
                    PlotBands = new[]
                            {
                                new YAxisPlotBands { From = 0, To = expectedLoss, Color = Color.Red },
                                new YAxisPlotBands { From = expectedLoss, To = expectedLoss+0.7, Color = Color.Yellow },
                                new YAxisPlotBands { From = expectedLoss+0.7, To = goalLoss, Color = Color.Green }
                            },
                    Labels = new YAxisLabels() { Style = "color:'black'"}
                };
            highchart.SetYAxis(yaxis);
            highchart.SetTooltip(new Tooltip() {Enabled = false});
            highchart.SetSubtitle(new Subtitle()
                {
                    Text = string.Format("Actual: {0} | Expected: {1} | Difference: {2}", actualLoss, expectedLoss, actualLoss-expectedLoss)
                });
            highchart.SetLegend(new Legend() {Enabled = false});
            return highchart.ToHtmlString();
        }