Color Palette

Apr 13, 2012 at 8:28 PM
Edited Apr 13, 2012 at 8:42 PM

 

I cannot seem to find a way to pass in a color palette list via DotNet.Highcharts.

Highcharts does expose the colors option that lets you send in a list of colors to be used by the series in chart . Is this exposed in this API?

 

EDIT.

Found it - just issue with my syntax from C# to VB. Is there any chance that documentation is coming soon as to what each option parameter is expected to be?

 

.SetOptions(New Helpers.GlobalOptions() With { _
            .Colors = {}

}
Apr 13, 2012 at 9:36 PM

Still unable to pass array of Colors. Getting "Not implemented serialization array of type: System.Drawing.Color[]".

Code:

Dim palette_colors() As System.Drawing.Color = {Color.Bisque, Color.SteelBlue, Color.MediumSlateBlue, Color.Plum, Color.SeaShell, Color.SkyBlue}

        Dim chart1 As Highcharts = New Highcharts("chart1").InitChart(New Chart() With { _
                                                                      .Height = chartH, _
                                                                      .Width = chartW, _
         .Type = ChartTypes.Spline _
        }).SetTitle(New Title() With { _
         .Text = "Annual Unemployment Rate" _
        }).SetTooltip(New Tooltip() With { _
         .Formatter = "function() { return '<b>'+ Highcharts.dateFormat('%b %Y', this.x) +'</b>: '+ this.y +' %'; }" _
        }).SetXAxis(New XAxis() With { _
         .Type = AxisTypes.Datetime _
         }).SetYAxis(New YAxis() With { _
           .Min = 0, _
           .Title = New YAxisTitle() With { _
            .Text = "Unemployment Rate", _
            .Align = AxisTitleAligns.High _
            } _
        }).SetPlotOptions(New PlotOptions() With { _
           .Series = New PlotOptionsSeries() With { _
               .Shadow = True}, _
           .Spline = New PlotOptionsSpline() With { _
            .Marker = New PlotOptionsSplineMarker() With { _
                .Enabled = False} _
        }}).SetOptions(New Helpers.GlobalOptions() With { _
            .Colors = palette_colors _
        }).SetSeries(SeriesList.[Select](Function(s) New Series() With { _
           .Name = s.Name, _
           .Data = s.Data _
          }).ToArray())

Coordinator
Apr 14, 2012 at 8:25 AM

This is known bug (http://dotnethighcharts.codeplex.com/workitem/359) which is fixed in current version (http://dotnethighcharts.codeplex.com/releases/view/85324). Download and use the latest version of the library.

Apr 16, 2012 at 1:54 PM

Excellent!

Worked as desired.