Click here to Skip to main content
15,042,336 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I am trying to display a chart with the x axis as the Time and the y axis as the Temperature. The data is retrieved from the SQL Server. On the XValueMember I put Time and YValueMember as Temperature. However, I am getting this error:

'Series data points do not support values of type System.TimeSpan only values of these types can be used: Double, Decimal, Single, int, long, uint, ulong, String, DateTime, short, ushort.'

I tried to change the data type to String or Time with no luck.

<asp:Chart ID="Chart1" runat="server" DataSourceID="ChartData"
    ImageStorageMode="UseImageLocation">
    <series>
        <asp:Series Name="Series1" ChartType="Line" XValueMember="Time"
            YValueMembers="Temperature">

    </series>
    <chartareas>
        <asp:ChartArea Name="ChartArea1">

    </chartareas>

    <asp:SqlDataSource ID="ChartData" runat="server"
        ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
        SelectCommand="SELECT [Time], [Temperature] FROM [Data]">
Posted
Comments
hitech_s 24-Sep-11 3:40am
   
what is the data type of time and temperature in your database
according to your answer i can proceed

1 solution

Chart1.Series[0].XValueType = System.Web.UI.DataVisualization.Charting.ChartValueType.Time;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900