views:

138

answers:

0

I have the following chart:

<asp:Chart ID="myChart" runat="server" Width="800px" >
<series>
                        <asp:Series ChartArea="ChartArea1" YValuesPerPoint="2" Name="Tasks" ChartType="RangeBar" CustomProperties="PointWidth=0.7" BorderColor="180, 26, 59, 105" Color="220, 65, 140, 240"></asp:Series>
                            </series>
                            <chartareas>
                                <asp:ChartArea Name="ChartArea1">
                                    <position Height="100" Width="100" X="10"></position>
                                    <axisy LineColor="64, 64, 64, 64" IsStartedFromZero="False">
                                        <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
                                        <MajorGrid LineColor="64, 64, 64, 64" />
                                    </axisy>
                                    <axisx LineColor="64, 64, 64, 64">
                                        <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" IsEndLabelVisible="False" />
                                        <MajorGrid LineColor="64, 64, 64, 64" />
                                    </axisx>
                                </asp:ChartArea>
                            </chartareas>
</asp:Chart><br />

That I am loading using the following code:

        string aLbl = "A";
        string bLbl = "B";
        DateTime d1 = new DateTime(2010,3,1);
        DateTime d2 = new DateTime(2010, 3, 2);
        DateTime d3 = new DateTime(2010, 3, 3);

        DataTable dt = new DataTable();
        dt.Columns.Add("Date");
        dt.Columns.Add("Name");
        dt.Columns.Add("Start");
        dt.Columns.Add("End");
        dt.Rows.Add(d1.ToShortDateString(), aLbl, 8, 12);
        dt.Rows.Add(d1.ToShortDateString(), aLbl, 13, 16);
        dt.Rows.Add(d1.ToShortDateString(), bLbl, 8, 12);
        dt.Rows.Add(d2.ToShortDateString(), aLbl, 8, 12);
        dt.Rows.Add(d2.ToShortDateString(), bLbl, 13, 18);
        dt.Rows.Add(d3.ToShortDateString(), aLbl, 8, 12);
        myChart.Series["Tasks"].XValueMember = "Name";
        myChart.Series["Tasks"].YValueMembers = "Start,End";
        myChart.Series["Tasks"].AxisLabel = "Date";
        myChart.DataSource = dt.AsDataView();
        myChart.DataBind();

Currently it will display all of the entries but I can't get them to group the way I would like. Below is how I would like it to display but haven't had any luck so far. Can anyone point me in the right direction?

3/1/2010
    A            8----12 13---16
    B            8--------------------------------23
3/2/2010
    A            8----12
    B                    13-------18