0

I have a data as below

  1. Date = 10,10,2014 , Value = 100
  2. Date = 10,11,2014 , Value = 20
  3. Date = 10,11,2014 , Value = 200
  4. Date = 10,12,2014 , Value = 80

these data are originated from SQL db .

Using asp.net chart . I pass the select command to a SQL Data source .

something like this

SELECT OrderTb.OrderDate As Date,  
      ProductTb.ProductPrice * OrderProductTb.ProductAmount AS Value 
FROM OrderTb 
  INNER JOIN OrderProductTb ON OrderTb.OrderID = OrderProductTb.OrderId 
  INNER JOIN ProductTb ON OrderProductTb.ProductId = ProductTb.ProductID 
ORDER BY OrderTb.OrderDate DESC

Will return 2 columns something similar as above data example .

My problem is . when i render the Asp.net Chart . For the date 10,11,2014 . the bar chart doesnt add the value for that date . it only show the highest value which is 200 and not 220 .

Below are my asp.net chart control .

 <asp:Chart ID="Chart1" runat="server"   DataSourceID="SqlDataSource1" 
        Width="600px" >
        <Series>
            <asp:Series   Name="Series1" XValueMember="OrderDate" XValueType="Date" YValueType="Auto"
                YValueMembers="Value"  
                 >
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            <axisy>
                <MajorGrid Enabled ="False" />
            </axisy>
            <axisx>
                <MajorGrid Enabled="false"/>
            </axisx>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AuthenticationDBConnectionString %>" 
            SelectCommand="">
    </asp:SqlDataSource>

Is there any way that i can sum the value up on that date , Tq in advance

Saravana Kumar
  • 3,669
  • 5
  • 15
  • 35

1 Answers1

0

You can use this library highcharts

$(function () {
$('#container').highcharts({
    chart: {
        type: 'column'
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    plotOptions: {
        series: {
            allowPointSelect: true
        }
    },
    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
});
});

jsfiddle

Mahmoude Elghandour
  • 2,921
  • 1
  • 22
  • 27