Create multi-series Stacked Column Chart using DotNet Highcharts in Windows Forms Application

Last Reply 2 months ago By dharmendr

Posted 2 months ago


What I want to do is add a side by side column chart and another stacked chart, multiple series using the code below.

Is this possible?

thank you very much!!

here is the code I have but only single series: 

    Protected Sub Render_Chart()
        Dim constring As String = WebConfigurationManager.ConnectionStrings("ComicDBConnectionString").ToString()
        Dim myConn As SqlConnection = New SqlConnection(constring)
        Dim commandText As String = "SELECT Month,Turnover FROM [Sales]"
        Dim myComm As SqlCommand = New SqlCommand(commandText, myConn)
        Dim reader As SqlDataReader = myComm.ExecuteReader()
        Dim chartValues As Object() = New Object(12) {}

        If reader.HasRows Then

            While reader.Read()
                chartValues(CInt(reader.GetValue(0)) - 1) = reader.GetValue(1)
            End While
            Console.WriteLine("No rows found.")
        End If

        Dim chart As DotNet.Highcharts.Highcharts = New DotNet.Highcharts.Highcharts("chart").InitChart(New Chart With {
                .DefaultSeriesType = ChartTypes.Column
            }).SetTitle(New Title With {
                .Text = "Monthly #s",
                .X = -20
            }).SetSubtitle(New Subtitle With {
                .Text = "Test",
                .X = -20
            }).SetXAxis(New XAxis With {
                .Categories = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
            }).SetSeries({New Series With {
                .Name = "# Test",
                .Data = New Data(chartValues)

        ltrChart1.Text = chart.ToHtmlString()
    End Sub

    Private Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load
    End Sub