0

My data:

Product_C====== Product_B====== product_A====== Month
124=========== 101=============== 60 ============= Feb
123============99=============== 59==============March
130=========== 100============= 70==============April

is it clear ;-) *?**
the aspx code:

<asp:CHART id="Chart1" runat="server">
<series>
    <asp:Series ChartArea="ChartArea1" Name="product_A" >
</asp:Series>
<asp:Series ChartArea="ChartArea1" Name="product_B">
    </asp:Series>
    <asp:Series ChartArea="ChartArea1" Name="product_C">
    </asp:Series>
    </series>
<chartareas>
  <asp:ChartArea Name="ChartArea1" > </asp:ChartArea> </chartareas>
</asp:CHART>

the binding code:

        private void BindMyChart(int firstMonth,int lastMonth )
        {
      dsDataset myDataset = new dsDataset();
      bsHelper myObj =   new   bsHelper();
      myDataset = myObj.GetCompareSalesByMonths(firstMonth,lastMonth);
      if(myDataset.myTable.Rows.Count>0)
        {
            Chart1.DataSource = myDataset.myTable;// 
            DataView dv = myDataset.myTable.DefaultView;
            Chart1.Series["product_A"].Points.DataBindXY(dv,"Product_A",dv, "month");
            Chart1.Series["product_B"].Points.DataBindXY(dv, "Product_B",dv, "month");
            Chart1.Series["product_C"].Points.DataBindXY(dv, "Product_C",dv, "month" );
            Chart1.DataBind();
         }
      }

protected void Page_Load(object sender, EventArgs e)
{


            if (!IsPostBack)
            {
         BindMyChart(Convert.ToInt32(ddlfirstMonth.SelectedValue),
               Convert.ToInt32(ddllastMonth.SelectedValue));//drop down lists
            }
}


the web.config:

    <assemblies><add assembly="System.Web.DataVisualization, 
     Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
   <httpHandlers>
    <add path="ChartImg.axd" verb="GET,HEAD"      type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler,      System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral,     PublicKeyToken=31bf3856ad364e35"   validate="false"/>
  </httpHandlers>
  <handlers>
  <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd"   type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization,   Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  </handlers>

It suppose to be like the image below: chart_required
but, I'm getting an empty,blank chart!
the method myDataset = myObj.GetCompareSalesByMonths(firstMonth,lastMonth); returns the desired data.

Alfabravo
  • 7,493
  • 6
  • 46
  • 82
Salahaldin
  • 92
  • 4
  • 15

0 Answers0