Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
How to display multiple rows as a single series on a line chart
posted

I'm brand new at using the webchart control, trying to create a simple 2d line chart using the following data below. I'd like to end up with 2 lines, one for each company. The x-axis should have tick marks for each date (jan, feb, mar, etc..). Each line would represent a company and be labelled as such. The thrid column (value) represents the actual points on the lines. So far, all the examples i see online do not deal with this specific circumstance. Many of them assume that the incoming data contains seperate columns for each datapoint (for example in my case i would have seperate columns for Jan, Feb, Mar , etc... in my data set. In my case, my dataset contains the values that i'd like to use for my x-axis. Hope this makes sense. thanks for any assistance.

Company  |   Date         |   Value

Xerox         01/01/2008  |    100
Xerox         02/01/2008  |    150
Xerox         03/01/2008  |    152
Xerox         04/01/2008  |    160
Xerox         05/01/2008  |    135
Walmart     01/01/2008  |    180
Walmart     02/01/2008  |    108
Walmart     03/01/2008  |    182
Walmart     04/01/2008  |    123
Walmart     05/01/2008  |    167

  • 26458
    Offline posted

    You can either use a table or series to fill the chart with data.

    If you want to use a table, you can do the following:
    create another value column (unfortunately, each line has to have its own numeric column)
    leave all the xerox data in one column, put all walmart data in another
    set chart.Data.SwapRowsAndColumn = true (otherwise, each line will represent a row and you'll have 5 lines instead of 2)

    If you use series, create 2 instances of NumericSeries
    ffill them with data by either adding points to the points collection or databinding them
    add each series to the chart's Series collection.