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
75
Need Help with Scatter or Line
posted

Hey, first off I'm sorry for the question if it sounds easy, I'm pretty new with ultrachart and it seems hard to find a lot of documentation on it.

 Either way what I need is a chart that is in column format  The catch is I need 2 groups on the x axis of labels.  So my x axis is going to be comprised of date and there will be months and years, but sometimes there will be 2 years in one chart.  So I need sections on the bottom for each year and then above that the months within that year.  This is in C# btw.

 My data set will be coming in from a sql select like this:

 Year       Month         Information
2008         11               300
2008         12               545
2009         1                 444
2009          2                400

 So I would need year as my main x axis and month as my secondary x axis, with Information as my y axis.

 Any help on this issue would be much appreciated or a link to some good examples or documentation would also help just as much.

Thank you
        

  • 26458
    Offline posted

    So you wanted something like the attached image? Might be a bit tricky with the data you have provided. First of all, the chart can't group multiple rows with the same year into one series, which is typically a single row. Second, each series must have an equal number of points, so you won't be able to display 2 months in one series and 3 months in the other.

    The table for this chart image would look like this:

    DataTable dt = new DataTable();
    dt.Columns.Add(
    "RowLabel", typeof(string));
    dt.Columns.Add(
    "month1", typeof(double));
    dt.Columns.Add(
    "month2", typeof(double));
    dt.Rows.Add(
    new object[ {"2008", 300, 545 });
    dt.Rows.Add(
    new object[ {"2009", 444, 400 });
    chart.Data.ZeroAligned = true;
    chart.DataSource = dt;