0

I am working on application where i need to render a chart using jquery + ajax request. For this i did work and got success for this i save chart image and then return a path and display on image source. but the problem is that dynamic feature of chart like mouse over and mouse out is not working for data point. offcourse its an image.

But now client want that feature and i am stuck. For this i did research jquery + ajax and chart control but not got any success.

So for this i found a method of saving Chart Control im XML file (Chart.SaveXML). and what i get, its write the whole aspx syntax for asp.net chart with all the chart data points.

But now what i want i want to load the chart by this xml file But it did not rendering chart.

Please help me , if any one have some suggestion

Raj
  • 1
  • 1
  • i am writing such type of code to rendering chart and the chart render type is BinaryStream – Raj Mar 04 '13 at 10:13

1 Answers1

0

This is what I would try.

Either when writing your chart to XML, or when reading from XML, you need to "convert" the XML chart data, to ASP.NET chart data.

For example: when you call "Chart.SaveXML", it will save like so:

<Chart Width="1100" Height="1000">
<Series>
    <Series Name="2011/12" YValuesPerPoint="2" ChartType="Bubble" ChartArea="ChartArea1" Color="68, 68, 68" BorderWidth="5" MarkerStyle="Circle" MarkerBorderColor="68, 68, 68">
        <Points>
            <DataPoint XValue="2.5496218995765276" YValues="0.586933333333333,0"/>
        </Points>
    </Series>
    <Series Name="2010/11" YValuesPerPoint="2" ChartType="Bubble" ChartArea="ChartArea1" Color="98, 98, 98" BorderWidth="5" MarkerStyle="Circle" MarkerBorderColor="98, 98, 98">
        <Points>
            <DataPoint XValue="1" YValues="0.756816666666667,0"/>
        </Points>
</Series>

You need to go though that and modify it to:

<asp:Chart runat="server" Width="1100" Height="1000">
<Series>
    <asp:Series Name="2011/12" YValuesPerPoint="2" ChartType="Bubble" ChartArea="ChartArea1" Color="68, 68, 68" BorderWidth="5" MarkerStyle="Circle" MarkerBorderColor="68, 68, 68">
        <Points>
            <asp:DataPoint XValue="2.5496218995765276" YValues="0.586933333333333,0" />
        </Points>
    </asp:Series>
    <asp:Series Name="2010/11" YValuesPerPoint="2" ChartType="Bubble" ChartArea="ChartArea1" Color="98, 98, 98" BorderWidth="5" MarkerStyle="Circle" MarkerBorderColor="98, 98, 98">
        <Points>
            <asp:DataPoint XValue="1" YValues="0.756816666666667,0" />
        </Points>
    </asp:Series>

You could do that mostly with steps like so:

myXmlData = myXmlData.Replace("<DataPoint", "<asp:DataPoint");

Watch out for the "<Series>" tag though: the collection (first one) is NOT an "asp:" tag, whereas the rest are.

That would convert the XML into valid ASP.NET markup, which you can then embed in a page somehow.

Sean
  • 14,359
  • 13
  • 74
  • 124