Alexandru Popa
Alexandru Popa

Reputation: 166

Chart type in ASP.NET

I am trying to make an web page ASP.NET application with Visual Studio

<body style="z-index: 1; left: 0px; top: 0px; position: absolute; height: 411px; width: 1040px">
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="FC Barcelona"></asp:Label>
        <br />
    <div style="height: 419px; width: 888px">

        <asp:Button ID="Button2" runat="server" style="position: relative; top: 23px; left: 177px" Text="Button" />
        <asp:Panel ID="Panel1" runat="server" Height="340px">
            <asp:Button ID="Button1" runat="server" Height="54px" OnClick="Button1_Click" style="margin-bottom: 3px" Text="Click" Width="65px" />
            <asp:Chart ID="Chart1" runat="server">
                <series>
                    <asp:Series ChartType="Line" Name="Series1">
                    </asp:Series>
                </series>
                <chartareas>
                    <asp:ChartArea Name="ChartArea1">
                    </asp:ChartArea>
                </chartareas>
            </asp:Chart>
        </asp:Panel>

    </div>
    </form>
</body>

Although I selected the Chart type as line in the Design, when I am running the application the chart in the web page is a Column chart. Does anybody know how to properly select the chart type?

Upvotes: 0

Views: 1758

Answers (1)

Stefan Orie
Stefan Orie

Reputation: 604

Maybe you should add some points first.
This works for me:

    <asp:Chart ID="Chart3" runat="server" >
        <Series>
            <asp:Series Name="Series1" BorderColor="Black" BackGradientStyle="DiagonalLeft" ChartType="Line">
                <Points>
                    <asp:DataPoint YValues="45" />
                    <asp:DataPoint YValues="15" />
                    <asp:DataPoint YValues="70" />
                    <asp:DataPoint YValues="50" />
                    <asp:DataPoint YValues="30" />
                    <asp:DataPoint YValues="10" />
                </Points>

            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart

Upvotes: 1

Related Questions