vb.net : How to create chart multiples series from SQL request

Hi,
I'm trying to make a nice chart like this one :
dNbfs.pngDatas are coming from a SQL resquest which output like this :
Col1                     Col2                    Col3
2008                    Item 1                  13
2008                    Item 2                  98
2008                    Item 3                  74
2009                    Item 1                  19
2009                    Item 2                  78

and so on.....

Open in new window


My problem is that I can find the way to create the output I'd like.
My last code is :
   <asp:Chart ID="Chart1" runat="server" DataSourceID="AccessDataSource1" 
        Height="558px" Palette="Bright" Width="930px">
        <Series>
            <asp:Series Legend="Legend1" Name="Item1" XValueMember="Col2" 
                YValueMembers="Col3" YValuesPerPoint="6">
            </asp:Series>
            <asp:Series ChartArea="ChartArea1" Legend="Legend1" Name="Item2" 
                XValueMember="Col2" YValueMembers="Col3">
            </asp:Series>
            <asp:Series ChartArea="ChartArea1" Legend="Legend1" Name="Item3" 
                XValueMember="Col2" YValueMembers="Col3">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </ChartAreas>
        <Legends>
            <asp:Legend Name="Legend1">
            </asp:Legend>
        </Legends>
        <Titles>
            <asp:Title Name="test 1">
            </asp:Title>
        </Titles>
    </asp:Chart>

Open in new window


for the following output :
output.PNG
Any help will be very welcome !
SybuxAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I don't understand what you are looking to add to your chart.  Is it labels?
0
SybuxAuthor Commented:
I want to see 3 columns for 2008, 3 for 2009 and not as shown on my last chart
0
Bob LearnedCommented:
Without labels on the X-axis, I have no way of knowing where the divisions are, without looking at the code.
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

SybuxAuthor Commented:
Sorry it was late yesterday when I create the post.

Based on the data, I'd like to output this chart :

Capture.PNG
0
Bob LearnedCommented:
You would need 3 different series that had data for 2008 and 2009, like this:

 <asp:Series Legend="Legend1" Name="Item1" ChartArea="ChartArea1" IsValueShownAsLabel="True" >
                <Points>
                    <asp:DataPoint XValue="2008" YValues="13" />
                    <asp:DataPoint XValue="2009" YValues="19" />
                </Points>
            </asp:Series>
            <asp:Series Legend="Legend1" Name="Item2" ChartArea="ChartArea1" IsValueShownAsLabel="True">
                <Points>
                    <asp:DataPoint XValue="2008" YValues="98" />
                    <asp:DataPoint XValue="2009" YValues="78" />
                </Points>
            </asp:Series>
            <asp:Series Legend="Legend1" Name="Item3" ChartArea="ChartArea1" IsValueShownAsLabel="True">
                <Points>
                    <asp:DataPoint XValue="2008" YValues="74" />
                </Points>
            </asp:Series>

Open in new window

0
Bob LearnedCommented:
Full chart:

 <asp:Chart ID="Chart1" runat="server" Height="558px" Palette="Bright" Width="930px">
        <Series>
            <asp:Series Legend="Legend1" Name="Item1" ChartArea="ChartArea1" IsValueShownAsLabel="True" >
                <Points>
                    <asp:DataPoint XValue="2008" YValues="13" />
                    <asp:DataPoint XValue="2009" YValues="19" />
                </Points>
            </asp:Series>
            <asp:Series Legend="Legend1" Name="Item2" ChartArea="ChartArea1" IsValueShownAsLabel="True">
                <Points>
                    <asp:DataPoint XValue="2008" YValues="98" />
                    <asp:DataPoint XValue="2009" YValues="78" />
                </Points>
            </asp:Series>
            <asp:Series Legend="Legend1" Name="Item3" ChartArea="ChartArea1" IsValueShownAsLabel="True">
                <Points>
                    <asp:DataPoint XValue="2008" YValues="74" />
                </Points>
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
                <AxisY Minimum="0" Maximum="120">
                </AxisY>

            </asp:ChartArea>
        </ChartAreas>
        <Legends>
            <asp:Legend Name="Legend1">
            </asp:Legend>
        </Legends>
        <Titles>
            <asp:Title Name="test 1">
            </asp:Title>
        </Titles>
    </asp:Chart>

Open in new window

0
SybuxAuthor Commented:
Ok thanks for your return but is there a way that the code should use the sql query instead as you should imagine, the example is not the reality of my datas !
0
Bob LearnedCommented:
You need 1 data series with data with "item1", and then another data series with "item 2", and then another data series with "item 3", so you would need more columns of data.

Year              Item 1         Item 2      Item 3

2008              13                  98              74
2009              19                  78
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.