Recently I've used zedgraph barchart to create a chart with 12 bars. I did want to put each bar on an x-axis scale and change the label name of that scale, but I did not success. Could you please show me the way the put my bars inside the scales?

Edited 3 Years Ago by Eternal Newbie

Attachments BarError.PNG 33.87 KB

Sure. Here's my code:

        'Naming the axis scale as string
        Dim lablex() As String
        ReDim lablex(0 To dsRp.Tables(2).Columns.Count - 1)
        For xa As Integer = 0 To dsRp.Tables(2).Columns.Count - 1
            lablex(xa) = dsRp.Tables(2).Rows(0).Item(xa)
        myPane.XAxis.Type = AxisType.Text
        myPane.XAxis.Scale.TextLabels = lablex

        'Creating Bars with legend names
        Dim colN1 As String = ""
        Dim colN2 As String = ""
        Dim x As Integer = 0, y As Double = 0

        For i As Integer = 0 To dsRp.Tables(1).Rows(0).Item("So_ky") - 1
            Dim list As New PointPairList
            colN1 = "Ky" + (i + 1).ToString
            colN2 = "NKy" + (i + 1).ToString
            x = i + 1
            y = dsRp.Tables(0).Rows(0).Item(colN1.Trim)
            list.Add(x, y)
            Dim e As BarItem
            e = myPane.AddBar(dsRp.Tables(2).Rows(0).Item(colN2), list, RandomColor())
            e.Color = RandomColor()

Thks Luc. Al last, I couldn't find a good solution then I removed zedgraph and now using my friend's dll.


I don't know which VB.Net version you're uusing, but there is a Chart Control provided.
You can find some information, Here

@LUc: Thks again. But, Chart tool's only been available since .NET 3.0, VS 2008. Cause I'm Using VS 2005 and .NET 2.0, I couldn't add chart tool if not installing .NET 3.0. And, in fact, in some of my tries, Microsoft Chart tool is quite... not good, right?

This article has been dead for over six months. Start a new discussion instead.