2
votes

Iam trying to create a chart in asp.net using inbuilt chart controls ,I read the data from the sql using a stored proc and stored it in a list .When I use the datacrosstable always the barchart is displayed.I need the line chart to be displayed.

Chart1.DataBindCrossTable(mylist,"engine", "year", "value","Label=value");

In markup I had also specified

<asp:Chart ID="Chart1" runat="server">
    <series>
        <asp:Series ChartType="Line" Name="Series1" />
    </series>
</asp:Chart>

also tried this in the cs page

Chart1.Series[0].BorderDashStyle = ChartDashStyle.Solid;
Chart1.Series[1].BorderDashStyle = ChartDashStyle.Solid;
1

1 Answers

2
votes

DataBindCrossTable creates a new series per unique value. So that <asp:Series... in your ASPX markup does not appply. You will have to set ChartType for each created series in code.