Beispiel #1
0
        public static HtmlString Highcharts(Highcharts chart, string id)
        {
            HighchartsRenderer highchartsRenderer = new HighchartsRenderer(chart);

            chart.ID             = id;
            chart.Chart.RenderTo = id;
            return(new HtmlString(highchartsRenderer.RenderHtml()));
        }
        public HighchartsRenderer Build()
        {
            var chartOptions = new Highcharts
            {
                Credits = new() { Enabled = false },
                Chart   = new() { BackgroundColor = "transparent" },

                Title = new Title
                {
                    Text = TitleText
                },
                XAxis = new List <XAxis>
                {
                    new XAxis
                    {
                        AllowDecimals = false,
                        Categories    = Labels,
                        //Labels = new XAxisLabels { Step = 12@*, Rotation = -40*@ }
                    }
                },
                YAxis = new List <YAxis> {
                    new YAxis
                    {
                        Title = new YAxisTitle
                        {
                            Text = YAxisTitleText
                        },
                    }
                },

                /*                Tooltip = new Tooltip
                 *              {
                 *                  PointFormat = "<b>{point.y:,.0f}</b> passangers"
                 *              },*/
                PlotOptions = new PlotOptions
                {
                    Area = new PlotOptionsArea
                    {
                        Marker = new PlotOptionsAreaMarker
                        {
                            Enabled = false,
                            Symbol  = "circle",
                            Radius  = 2,
                            States  = new PlotOptionsAreaMarkerStates
                            {
                                Hover = new PlotOptionsAreaMarkerStatesHover
                                {
                                    Enabled = true
                                }
                            }
                        }
                    }
                },
                Series = Data
            };

            chartOptions.ID = Id;
            var renderer = new HighchartsRenderer(chartOptions);

            return(renderer);
        }
    }