سؤال

*This is a name I have seen used for the style of chart I'm after - not sure how 'official' this name is.

What I would like:

  • Bar Chart
  • X - Day of the Week
  • Y - Number of items
  • Z - Week Number, receding back into the chart.

I'm not sure that the Chart Control can do it, but I might be missing something in the many many properties and settings the control has.

هل كانت مفيدة؟

المحلول

After a hint from pnuts. i've dug in an read up some more on the Chart Control....

3d Bar Chart

I've created a 3D 'Manhattan' style chart. There's the datasource selects data with columns such as DayName, NumberOfOrders and WeekNo.

The chart should have clustering turned off and you need to use a special databinding method.

Chart1.DataBindCrossTable(ds.GetYearsOrdersByDay, "WeekNo", "DayName", "NumberOfOrders", null);

This creates several series based on the dataset and the parameters.

Basic markup

<asp:Chart ID="Chart1" runat="server" Height="600px" Width="700px">
    <Series>

    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1">
            <Area3DStyle Enable3D="True" IsClustered="false"  Perspective="20"/>     
            <AxisY Interval="100"></AxisY>
            <AxisX IntervalOffset ="1.0" Interval ="1.0" >
                <MajorGrid Enabled="true" Interval="1.0" IntervalOffset="0.5" />
            </AxisX>
        </asp:ChartArea> 

    </ChartAreas>
    <Legends>
        <asp:Legend Name="Legend1" Title="Number of Orders">
        </asp:Legend>
    </Legends>
</asp:Chart>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top