This project is read-only.

Cannot create BoxPlot chart

Sep 22, 2013 at 10:29 AM
I have added a reference to Dotnet.HighCharts DLL in my asp.net web application.
I have took reference from code samples and I am trying to create a BoxPlot chart.

Can you please help in this regard ?

Script of webpage:

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"" type="text/javascript"></script>
<script src="../../Scripts/highcharts.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Literal ID="ltrChart" runat="server"></asp:Literal>
</asp:Content>

Code is as below:

DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
        .InitChart(new Chart { Type = ChartTypes.Boxplot, Width = 600, Height = 400 })
            .SetTitle(new Title { Text = "Highcharts Box Plot Example" })
            .SetLegend(new Legend { Enabled = false })
            .SetXAxis(new XAxis
            {
                Categories = new[] { "1", "2", "3", "4", "5" },
                Title = new XAxisTitle { Text = "Experiment No." }
            })
            .SetYAxis(new YAxis
            {
                Title = new YAxisTitle { Text = "Observations" },
                PlotLines = new[]
                        {
                            new YAxisPlotLines
                                {
                                    Value = 932,
                                    Color = Color.FromName("red"),
                                    Width = 1,
                                    Label = new YAxisPlotLinesLabel
                                        {
                                            Text = "Theoretical mean: 932",
                                            Align = HorizontalAligns.Center,
                                            Style = "color: 'gray'"
                                        }
                                }
                        }
            })
            .SetSeries(new[]
                {
                    new Series
                        {

                            Name = "Observations",
                            Data = new Data(new object[]
                                {
                                    new object[] { 760, 801, 848, 895, 965 },
                                    new object[] { 733, 853, 939, 980, 1080 },
                                    new object[] { 714, 762, 817, 870, 918 },
                                    new object[] { 724, 802, 806, 871, 950 },
                                    new object[] { 834, 836, 864, 882, 910 }
                                })
                        },
                    new Series
                        {

                            Name = "Outlier",
                            Data = new Data(new object[,]
                                {
                                    { 0, 644 },
                                    { 4, 718 },
                                    { 4, 951 },
                                    { 4, 969 }
                                }),
                            Type = ChartTypes.Scatter,
                            Color = Color.FromName("Highcharts.getOptions().colors[0]"),
                            PlotOptionsScatter = new PlotOptionsScatter
                                {
                                    Marker = new PlotOptionsScatterMarker
                                        {
                                            FillColor = new BackColorOrGradient(Color.FromName("white")),
                                            LineWidth = 1,
                                            LineColor = Color.FromName("Highcharts.getOptions().colors[0]")
                                        }
                                }
                        }
                })
Oct 24, 2013 at 1:32 PM
Hi,

You should have javascript error like: "Highcharts error #17: www.highcharts.com/errors/17"

And the description for this error is:
Highcharts Error #17

The requested series type does not exist

This error happens when you are setting chart.type or series.type to a series type this isn't defined in Highcharts. A typical reason may be that your are missing the extension file where the serires type is defined, for example in order to run an arearange series you need to load the highcharts-more.js file.
So, download and reference to highcharts-more.js file in your project.

Regards,
Vangi