This is a migrated thread and some comments may be shown as answers.

Adding line graph with months and a point for each day

5 Answers 151 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 28 Feb 2012, 07:49 PM
I have data that I need to add a point for each day. I have my code working well enough to label my x axis as mar feb apr etc. Where I'm stuck is on how I add all of the data points.
I have the stored in a datatable with three fields, label (the month), position (an int of its position i.e. 0 is jan, 1 is feb etc), and value (the daily value)

Here's the code I have so far on trying to add the points but it doesn't seem to be working. I'm fairly new with these charts, so please bear with me.

'a holder for the current month
        Dim currentMonth = ""
 
        'a holder for the count
        Dim count = -1
 
        Dim rangeTable As New DataTable
        rangeTable.Columns.Add("Label")
        rangeTable.Columns.Add("Position")
        rangeTable.Columns.Add("Value")
 
 
        Using myconn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("connection").ToString)
 
            myconn.Open()
            Dim cmd = New SqlCommand(sql, myconn)
            Dim reader = cmd.ExecuteReader()
            While reader.Read()
 
                'if the currentMonth is new, then we add it to the data table for a range
                If Not (currentMonth = (Format(reader("DateHour"), "MMMM"))) Then
                    currentMonth = Format(reader("DateHour"), "MMMM")
 
                    count = count + 1
                 
                End If
 
                rangeTable.Rows.Add(currentMonth, count, reader("PointAverage"))
 
                'Dim tempSeries As New ChartSeries
                'tempSeries.SetValues(1, 2)
                'chart.Series.Add(tempSeries)
 
            End While
 
            myconn.Close()
 
        End Using 'using myconn
 
        'add the range
        chart.PlotArea.XAxis.AddRange(0, count, 1)
 
        For Each i As DataRow In rangeTable.Rows
            chart.PlotArea.XAxis(i("Position")).TextBlock.Text = i("Label")
            Dim tempSeries As New ChartSeries
            tempSeries.SetValues(i("Position"), i("Value"))
            chart.Series.Add(tempSeries)
        Next

A sample of what my data table would look like is something like this
Label Position Value
january 0 10
january 0 20
january 0 30
february 1 10
february 1 20
etc. 

Essentially, I need to add all of the points in each month, but they are in succession by day. So I pull all of the days for jan, feb, and so on. Any ideas on how to go about this?





5 Answers, 1 is accepted

Sort by
0
Web Services
Top achievements
Rank 2
answered on 29 Feb 2012, 04:49 PM
Any help here?
0
Petar Marchev
Telerik team
answered on 02 Mar 2012, 03:40 PM
Hello,

Thank you for the attached code.

I created a new project using your code. I had to modify it slightly because I do not have your database. When I run the project I do get a populated chart - examine the attached snapshot ChartOk.png.

You said that it isn't working and I can see that it is, but this is probably not the output that you need for your project.

This is why I have attached a very simple project that will get you started with our asp.net ajax chart. I have also attached a snapshot of the output that it produces.

In the attached project I have created a new class DateInfo, which I think suits the needs of your current project. It has properties Position, Value, Label. I have created a list of DateInfo (instead of the DataTable) that will be the source of the chart. I have removed the DataTable because it was an unneeded intermediary.

Now we should specify how the chart should process a DateInfo. This is done in html by setting the DataXColumn and DataYColumn properties of the chart series and DataLabelsColumn property of the X axis.

I hope this short introduction helps. I would suggest that you examine our online demos so that you get familiar with the chart features, limitations and how to-s.

All the best,
Petar Marchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 02 Mar 2012, 05:37 PM
Second Edit* So I'm a bit further but I'm still stuck. I am adding things to the graph but it looks crazy so I'm not doing something right. In order to help you guys help me, I posted is some of the data I am using. You see how the label is the month the position is the int position, the value is the y value and count is where it sits within a given x position. Here is a link to some code. http://dl.dropbox.com/u/4979877/code.txt  You can take this and create the same data table I'm using to help me figure this out. I pasted my code below the data as to how I'm trying to do it now. Hopefully I got you enough stuff to help me out :). Thanks in advance.


Label Position Value Count
March 0 1459.57 1
March 0 1688.68 2
March 0 2752.2 3
March 0 3023.24 4
March 0 2477.25 5
March 0 2457.82 6
March 0 3012.38 7
March 0 2872.26 8
March 0 2951.39 9
March 0 3279.6 10
March 0 3212.79 11
March 0 3217.38 12
March 0 2993.71 13
March 0 3171.32 14
March 0 3090.28 15
March 0 3273.16 16
March 0 3419.4 17
March 0 3314.18 18
March 0 3346.24 19
March 0 3342.27 20
March 0 3434.71 21
March 0 3431.34 22
March 0 3142.77 23
March 0 3487.43 24
March 0 3621.11 25
March 0 3544.9 26
March 0 3095.63 27
March 0 3119.59 28
March 0 3474.35 29
March 0 3130.99 30
April 1 3396.14 1
April 1 2957.05 2
April 1 3248.07 3
April 1 3608.23 4
April 1 3457.43 5
April 1 3094.18 6
April 1 3232.07 7
April 1 3474.04 8
April 1 3263.83 9
April 1 3547.73 10
April 1 3038.4 11
April 1 3286.79 12
April 1 3154.33 13
April 1 2751.21 14
April 1 2955.75 15
April 1 2962.79 16
April 1 2971.74 17
April 1 2901.11 18
April 1 2865.15 19
April 1 2959.12 20
April 1 3120.2 21
April 1 2930.8 22
April 1 2879.15 23
April 1 2910.07 24
April 1 3064.03 25
April 1 3202.69 26
April 1 2625.78 27
April 1 3178.12 28
April 1 2793.9 29
April 1 2948.79 30
May 2 3209.35 1
May 2 3162.49 2
May 2 3493.62 3


For Each i As DataRow In rangeTable.Rows
 
    mychart.PlotArea.XAxis(i("Position")).TextBlock.Text = i("Label")
 
    'Dim myPoint As New DataPoint()
    Dim myPoint As New ChartSeriesItem
 
    myPoint.XValue = i("Position")
    myPoint.YValue = i("Value")
    mySeries.AddItem(myPoint)
 
    'output &= "myTable.Rows.Add(""" & i("Label") & """, """ & i("Position") & """, """ & i("Value") & """, """ & i("Count") & """)<br />"
 
    'output &= "<tr><td>" & i("Label") & "</td><td>" & i("Position") & "</td><td>" & i("Value") & "</td><td>" & i("Count") & "</td><td></tr>"
 
 
Next

0
Petar Marchev
Telerik team
answered on 07 Mar 2012, 01:43 PM
Hello,

I created a new project using the code you have provided. I had to make slight changes to it so that I can run and test it.

I see a total of 10 bars and a lot of labels. The reason for the many labels is that you have many items. The reason for only 10 bars is that for each series item of the same month you are specifying the same XValue:
 
myPoint.XValue = i("Position")

If you want to see a different bar for each data item you need to give each series item a unique XValue, for instance:
myPoint.XValue = counter
counter = counter + 1

If you need further help - you can send us a drawing of some sort, so that we can understand what are the needed results and output.

Until then, I again recommend that you examine our examples here, so that you can learn what is possible and how to achieve it with RadChart.

Regards,
Petar Marchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 08 Mar 2012, 04:39 PM
Ok, I got this working the way I need. I'm posting all of my code along with the sample data so if anyone else comes across this they'll see what I did.  Here's the data in full the code is below
Dim myTable as New DataTable()
myTable.Columns.Add("Label")
myTable.Columns.Add("Position")
myTable.Columns.Add("Value")
myTable.Columns.Add("Count")
myTable.Rows.Add("March", "0", "3012.38", "-1")
myTable.Rows.Add("March", "0", "2872.26", "0")
myTable.Rows.Add("March", "0", "2951.39", "1")
myTable.Rows.Add("March", "0", "3279.6", "2")
myTable.Rows.Add("March", "0", "3212.79", "3")
myTable.Rows.Add("March", "0", "3217.38", "4")
myTable.Rows.Add("March", "0", "2993.71", "5")
myTable.Rows.Add("March", "0", "3171.32", "6")
myTable.Rows.Add("March", "0", "3090.28", "7")
myTable.Rows.Add("March", "0", "3273.16", "8")
myTable.Rows.Add("March", "0", "3419.4", "9")
myTable.Rows.Add("March", "0", "3314.18", "10")
myTable.Rows.Add("March", "0", "3346.24", "11")
myTable.Rows.Add("March", "0", "3342.27", "12")
myTable.Rows.Add("March", "0", "3434.71", "13")
myTable.Rows.Add("March", "0", "3431.34", "14")
myTable.Rows.Add("March", "0", "3142.77", "15")
myTable.Rows.Add("March", "0", "3487.43", "16")
myTable.Rows.Add("March", "0", "3621.11", "17")
myTable.Rows.Add("March", "0", "3544.9", "18")
myTable.Rows.Add("March", "0", "3095.63", "19")
myTable.Rows.Add("March", "0", "3119.59", "20")
myTable.Rows.Add("March", "0", "3474.35", "21")
myTable.Rows.Add("March", "0", "3130.99", "22")
myTable.Rows.Add("April", "1", "3396.14", "23")
myTable.Rows.Add("April", "1", "2957.05", "24")
myTable.Rows.Add("April", "1", "3248.07", "25")
myTable.Rows.Add("April", "1", "3608.23", "26")
myTable.Rows.Add("April", "1", "3457.43", "27")
myTable.Rows.Add("April", "1", "3094.18", "28")
myTable.Rows.Add("April", "1", "3232.07", "29")
myTable.Rows.Add("April", "1", "3474.04", "30")
myTable.Rows.Add("April", "1", "3263.83", "31")
myTable.Rows.Add("April", "1", "3547.73", "32")
myTable.Rows.Add("April", "1", "3038.4", "33")
myTable.Rows.Add("April", "1", "3286.79", "34")
myTable.Rows.Add("April", "1", "3154.33", "35")
myTable.Rows.Add("April", "1", "2751.21", "36")
myTable.Rows.Add("April", "1", "2955.75", "37")
myTable.Rows.Add("April", "1", "2962.79", "38")
myTable.Rows.Add("April", "1", "2971.74", "39")
myTable.Rows.Add("April", "1", "2901.11", "40")
myTable.Rows.Add("April", "1", "2865.15", "41")
myTable.Rows.Add("April", "1", "2959.12", "42")
myTable.Rows.Add("April", "1", "3120.2", "43")
myTable.Rows.Add("April", "1", "2930.8", "44")
myTable.Rows.Add("April", "1", "2879.15", "45")
myTable.Rows.Add("April", "1", "2910.07", "46")
myTable.Rows.Add("April", "1", "3064.03", "47")
myTable.Rows.Add("April", "1", "3202.69", "48")
myTable.Rows.Add("April", "1", "2625.78", "49")
myTable.Rows.Add("April", "1", "3178.12", "50")
myTable.Rows.Add("April", "1", "2793.9", "51")
myTable.Rows.Add("April", "1", "2948.79", "52")
myTable.Rows.Add("May", "2", "3209.35", "53")
myTable.Rows.Add("May", "2", "3162.49", "54")
myTable.Rows.Add("May", "2", "3493.62", "55")
myTable.Rows.Add("May", "2", "2967.23", "56")
myTable.Rows.Add("May", "2", "3230.32", "57")
myTable.Rows.Add("May", "2", "3509.32", "58")
myTable.Rows.Add("May", "2", "3779.29", "59")
myTable.Rows.Add("May", "2", "3621.12", "60")
myTable.Rows.Add("May", "2", "3644.46", "61")
myTable.Rows.Add("May", "2", "3466.32", "62")
myTable.Rows.Add("May", "2", "3446.87", "63")
myTable.Rows.Add("May", "2", "3466.92", "64")
myTable.Rows.Add("May", "2", "4259.01", "65")
myTable.Rows.Add("May", "2", "3546.58", "66")
myTable.Rows.Add("May", "2", "3667.34", "67")
myTable.Rows.Add("May", "2", "3741.49", "68")
myTable.Rows.Add("May", "2", "3555.92", "69")
myTable.Rows.Add("May", "2", "4607.65", "70")
myTable.Rows.Add("May", "2", "4562.81", "71")
myTable.Rows.Add("May", "2", "4693.74", "72")
myTable.Rows.Add("May", "2", "5132.14", "73")
myTable.Rows.Add("May", "2", "5537.25", "74")
myTable.Rows.Add("May", "2", "5416.58", "75")
myTable.Rows.Add("May", "2", "5512.08", "76")
myTable.Rows.Add("May", "2", "5492.56", "77")
myTable.Rows.Add("May", "2", "5573.6", "78")
myTable.Rows.Add("May", "2", "5459.51", "79")
myTable.Rows.Add("May", "2", "5553.01", "80")
myTable.Rows.Add("May", "2", "5668.33", "81")
myTable.Rows.Add("May", "2", "5624.64", "82")
myTable.Rows.Add("May", "2", "5535.42", "83")
myTable.Rows.Add("June", "3", "5285.11", "84")
myTable.Rows.Add("June", "3", "5308.3", "85")
myTable.Rows.Add("June", "3", "5280.82", "86")
myTable.Rows.Add("June", "3", "5339.75", "87")
myTable.Rows.Add("June", "3", "5309.52", "88")
myTable.Rows.Add("June", "3", "5200.86", "89")
myTable.Rows.Add("June", "3", "5229.09", "90")
myTable.Rows.Add("June", "3", "5208.66", "91")
myTable.Rows.Add("June", "3", "5230.47", "92")
myTable.Rows.Add("June", "3", "5280.82", "93")
myTable.Rows.Add("June", "3", "5151.8", "94")
myTable.Rows.Add("June", "3", "5299.88", "95")
myTable.Rows.Add("June", "3", "5238.73", "96")
myTable.Rows.Add("June", "3", "5474.89", "97")
myTable.Rows.Add("June", "3", "5638.19", "98")
myTable.Rows.Add("June", "3", "5612.32", "99")
myTable.Rows.Add("June", "3", "5656.78", "100")
myTable.Rows.Add("June", "3", "5601.84", "101")
myTable.Rows.Add("June", "3", "1062.54", "102")
myTable.Rows.Add("June", "3", "1370.55", "103")
myTable.Rows.Add("June", "3", "5096.09", "104")
myTable.Rows.Add("June", "3", "4983.76", "105")
myTable.Rows.Add("June", "3", "5082.78", "106")
myTable.Rows.Add("June", "3", "5115", "107")
myTable.Rows.Add("June", "3", "5148.11", "108")
myTable.Rows.Add("June", "3", "5167.26", "109")
myTable.Rows.Add("June", "3", "5107.12", "110")
myTable.Rows.Add("June", "3", "5115.38", "111")
myTable.Rows.Add("July", "4", "5144.46", "112")
myTable.Rows.Add("July", "4", "5179.89", "113")
myTable.Rows.Add("July", "4", "5098.85", "114")
myTable.Rows.Add("July", "4", "4859.87", "115")
myTable.Rows.Add("July", "4", "4823.93", "116")
myTable.Rows.Add("July", "4", "4756.26", "117")
myTable.Rows.Add("July", "4", "4683.87", "118")
myTable.Rows.Add("July", "4", "4783.04", "119")
myTable.Rows.Add("July", "4", "4700.48", "120")
myTable.Rows.Add("July", "4", "4741.18", "121")
myTable.Rows.Add("July", "4", "4718.84", "122")
myTable.Rows.Add("July", "4", "4792.91", "123")
myTable.Rows.Add("July", "4", "4803.93", "124")
myTable.Rows.Add("July", "4", "4718.3", "125")
myTable.Rows.Add("July", "4", "4321.84", "126")
myTable.Rows.Add("July", "4", "4138.71", "127")
myTable.Rows.Add("July", "4", "4278.38", "128")
myTable.Rows.Add("July", "4", "4179.43", "129")
myTable.Rows.Add("July", "4", "4272.71", "130")
myTable.Rows.Add("July", "4", "4326.58", "131")
myTable.Rows.Add("July", "4", "4155.86", "132")
myTable.Rows.Add("July", "4", "3964.63", "133")
myTable.Rows.Add("July", "4", "4058.06", "134")
myTable.Rows.Add("July", "4", "4055.99", "135")
myTable.Rows.Add("July", "4", "4512.61", "136")
myTable.Rows.Add("July", "4", "4902.12", "137")
myTable.Rows.Add("July", "4", "4768.19", "138")
myTable.Rows.Add("July", "4", "4740.42", "139")
myTable.Rows.Add("July", "4", "4963.64", "140")
myTable.Rows.Add("July", "4", "4880.53", "141")
myTable.Rows.Add("July", "4", "4906.32", "142")
myTable.Rows.Add("August", "5", "4863.85", "143")
myTable.Rows.Add("August", "5", "4675.68", "144")
myTable.Rows.Add("August", "5", "4589.06", "145")
myTable.Rows.Add("August", "5", "4742.94", "146")
myTable.Rows.Add("August", "5", "4769.72", "147")
myTable.Rows.Add("August", "5", "4750.44", "148")
myTable.Rows.Add("August", "5", "4760.46", "149")
myTable.Rows.Add("August", "5", "4909.08", "150")
myTable.Rows.Add("August", "5", "4476.03", "151")
myTable.Rows.Add("August", "5", "4536.11", "152")
myTable.Rows.Add("August", "5", "4664.04", "153")
myTable.Rows.Add("August", "5", "4664.04", "154")
myTable.Rows.Add("August", "5", "4746.77", "155")
myTable.Rows.Add("August", "5", "4508.93", "156")
myTable.Rows.Add("August", "5", "4681.73", "157")
myTable.Rows.Add("August", "5", "4720.9", "158")
myTable.Rows.Add("August", "5", "4720.6", "159")
myTable.Rows.Add("August", "5", "4499.45", "160")
myTable.Rows.Add("August", "5", "4420.63", "161")
myTable.Rows.Add("August", "5", "4374.48", "162")
myTable.Rows.Add("August", "5", "4419.86", "163")
myTable.Rows.Add("August", "5", "4123.56", "164")
myTable.Rows.Add("August", "5", "4424.99", "165")
myTable.Rows.Add("August", "5", "4381.61", "166")
myTable.Rows.Add("August", "5", "4393.16", "167")
myTable.Rows.Add("August", "5", "4299.95", "168")
myTable.Rows.Add("August", "5", "4795.97", "169")
myTable.Rows.Add("August", "5", "4648.82", "170")
myTable.Rows.Add("August", "5", "4510.01", "171")
myTable.Rows.Add("September", "6", "3911.37", "172")
myTable.Rows.Add("September", "6", "3746.54", "173")
myTable.Rows.Add("September", "6", "3129.76", "174")
myTable.Rows.Add("September", "6", "3351.83", "175")
myTable.Rows.Add("September", "6", "3012.22", "176")
myTable.Rows.Add("September", "6", "2735.98", "177")
myTable.Rows.Add("September", "6", "2904.55", "178")
myTable.Rows.Add("September", "6", "2757.63", "179")
myTable.Rows.Add("September", "6", "2863.7", "180")
myTable.Rows.Add("September", "6", "3177.44", "181")
myTable.Rows.Add("September", "6", "3101.68", "182")
myTable.Rows.Add("September", "6", "3181.65", "183")
myTable.Rows.Add("September", "6", "2578.03", "184")
myTable.Rows.Add("September", "6", "2174.22", "185")
myTable.Rows.Add("September", "6", "2263.91", "186")
myTable.Rows.Add("September", "6", "2591.12", "187")
myTable.Rows.Add("September", "6", "2459.27", "188")
myTable.Rows.Add("September", "6", "2871.5", "189")
myTable.Rows.Add("September", "6", "2649.05", "190")
myTable.Rows.Add("September", "6", "3499.37", "191")
myTable.Rows.Add("September", "6", "3407.39", "192")
myTable.Rows.Add("September", "6", "3255.57", "193")
myTable.Rows.Add("September", "6", "3124.94", "194")
myTable.Rows.Add("September", "6", "3368.59", "195")
myTable.Rows.Add("September", "6", "3601.53", "196")
myTable.Rows.Add("September", "6", "3299.87", "197")
myTable.Rows.Add("September", "6", "3418.56", "198")
myTable.Rows.Add("September", "6", "3579.41", "199")
myTable.Rows.Add("October", "7", "2975.95", "200")
myTable.Rows.Add("October", "7", "3931.34", "201")
myTable.Rows.Add("October", "7", "3648.66", "202")
myTable.Rows.Add("October", "7", "2882.14", "203")
myTable.Rows.Add("October", "7", "3026.23", "204")
myTable.Rows.Add("October", "7", "2854.13", "205")
myTable.Rows.Add("October", "7", "2508.83", "206")
myTable.Rows.Add("October", "7", "3047.5", "207")
myTable.Rows.Add("October", "7", "2966.59", "208")
myTable.Rows.Add("October", "7", "2986.28", "209")
myTable.Rows.Add("October", "7", "3083.48", "210")
myTable.Rows.Add("October", "7", "4047.16", "211")
myTable.Rows.Add("October", "7", "3990.46", "212")
myTable.Rows.Add("October", "7", "3785.7", "213")
myTable.Rows.Add("October", "7", "3381.2", "214")
myTable.Rows.Add("October", "7", "4028.4", "215")
myTable.Rows.Add("October", "7", "2194.93", "216")
myTable.Rows.Add("October", "7", "0.66", "217")
myTable.Rows.Add("October", "7", "0.66", "218")
myTable.Rows.Add("October", "7", "0.66", "219")
myTable.Rows.Add("October", "7", "0.66", "220")
myTable.Rows.Add("October", "7", "0.66", "221")
myTable.Rows.Add("October", "7", "0.66", "222")
myTable.Rows.Add("October", "7", "0.66", "223")
myTable.Rows.Add("October", "7", "0.66", "224")
myTable.Rows.Add("October", "7", "0.66", "225")
myTable.Rows.Add("October", "7", "0.66", "226")
myTable.Rows.Add("October", "7", "68.05", "227")
myTable.Rows.Add("October", "7", "2099.34", "228")
myTable.Rows.Add("October", "7", "2555.08", "229")
myTable.Rows.Add("October", "7", "1933.82", "230")
myTable.Rows.Add("November", "8", "0.66", "231")
myTable.Rows.Add("November", "8", "0.66", "232")
myTable.Rows.Add("November", "8", "559.66", "233")
myTable.Rows.Add("November", "8", "2564.17", "234")
myTable.Rows.Add("November", "8", "2764.39", "235")
myTable.Rows.Add("November", "8", "3042.85", "236")
myTable.Rows.Add("November", "8", "2714.63", "237")
myTable.Rows.Add("November", "8", "2641.39", "238")
myTable.Rows.Add("November", "8", "2867.27", "239")
myTable.Rows.Add("November", "8", "2399.4", "240")
myTable.Rows.Add("November", "8", "2049.52", "241")
myTable.Rows.Add("November", "8", "2271.94", "242")
myTable.Rows.Add("November", "8", "2168.25", "243")
myTable.Rows.Add("November", "8", "2400.18", "244")
myTable.Rows.Add("November", "8", "2043.11", "245")
myTable.Rows.Add("November", "8", "1621.65", "246")
myTable.Rows.Add("November", "8", "1936.62", "247")
myTable.Rows.Add("November", "8", "2378.49", "248")
myTable.Rows.Add("November", "8", "2813.8", "249")
myTable.Rows.Add("November", "8", "2252.27", "250")
myTable.Rows.Add("November", "8", "2989.1", "251")
myTable.Rows.Add("November", "8", "3669.17", "252")
myTable.Rows.Add("November", "8", "3140.71", "253")
myTable.Rows.Add("November", "8", "2724.57", "254")
myTable.Rows.Add("November", "8", "2712.72", "255")
myTable.Rows.Add("November", "8", "2149.2", "256")
myTable.Rows.Add("November", "8", "2247.38", "257")
myTable.Rows.Add("November", "8", "2685.2", "258")
myTable.Rows.Add("November", "8", "3654.25", "259")
myTable.Rows.Add("December", "9", "2129.84", "260")
myTable.Rows.Add("December", "9", "2082.21", "261")
myTable.Rows.Add("December", "9", "1877.74", "262")
myTable.Rows.Add("December", "9", "1641.27", "263")
myTable.Rows.Add("December", "9", "1158.34", "264")
myTable.Rows.Add("December", "9", "1991.34", "265")
myTable.Rows.Add("December", "9", "1869.75", "266")
myTable.Rows.Add("December", "9", "1960.4", "267")
myTable.Rows.Add("December", "9", "1910.68", "268")
myTable.Rows.Add("December", "9", "1912.68", "269")
myTable.Rows.Add("December", "9", "2461.47", "270")
myTable.Rows.Add("December", "9", "2689.52", "271")
myTable.Rows.Add("December", "9", "2439.85", "272")
myTable.Rows.Add("December", "9", "3229.32", "273")
myTable.Rows.Add("December", "9", "2707.17", "274")
myTable.Rows.Add("December", "9", "4070.23", "275")
myTable.Rows.Add("December", "9", "3713.56", "276")
myTable.Rows.Add("December", "9", "3573.98", "277")
myTable.Rows.Add("December", "9", "2534.32", "278")
myTable.Rows.Add("December", "9", "1759.16", "279")
myTable.Rows.Add("December", "9", "1964.71", "280")
myTable.Rows.Add("December", "9", "1408.92", "281")
myTable.Rows.Add("December", "9", "1753.56", "282")
myTable.Rows.Add("December", "9", "2557.57", "283")
myTable.Rows.Add("December", "9", "2540.22", "284")
myTable.Rows.Add("December", "9", "2364.88", "285")
myTable.Rows.Add("December", "9", "2445.9", "286")
myTable.Rows.Add("December", "9", "1769.26", "287") 


'create a series (the bars)
       Dim mySeries As New ChartSeries
 
       'set it to a line
       mySeries.Type = ChartSeriesType.Line
 
 
       'mychart.PlotArea.YAxis.AddRange(3225, 3270, 5)
       For Each i As DataRow In rangeTable.Rows
 
           mychart.PlotArea.XAxis(i("Position")).TextBlock.Text = i("Label")
 
           'Dim myPoint As New DataPoint()
           Dim myPoint As New ChartSeriesItem
 
           myPoint.XValue = i("Count")
           myPoint.YValue = i("Value")
           mySeries.AddItem(myPoint)
 
           'output &= "myTable.Rows.Add(""" & i("Label") & """, """ & i("Position") & """, """ & i("Value") & """, """ & i("Count") & """)<br />"
 
           'output &= "<tr><td>" & i("Label") & "</td><td>" & i("Position") & "</td><td>" & i("Value") & "</td><td>" & i("Count") & "</td><td></tr>"
 
 
       Next
 
 
 
       'output &= "</table>"
       mychart.Series.Add(mySeries)
 
       'set the fill style and bar width
       mySeries.Appearance.FillStyle.FillType = Styles.FillType.Solid





Tags
Chart (Obsolete)
Asked by
Web Services
Top achievements
Rank 2
Answers by
Web Services
Top achievements
Rank 2
Petar Marchev
Telerik team
Share this question
or