Chart with strXML generated from GridView
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Chart with strXML generated from GridView Expand / Collapse
Author
Message
Posted 6/24/2008 6:54:01 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/28/2008 6:24:14 AM
Posts: 1, Visits: 15
Hi. I created a MSLine chart with strXML generated from the data displayed on GridView and it works fine.

I want to update the chart when GridView is sorted but it didn't work at all.

Can anybody tell me how to run createchart() whenerver I want to pull the triger like sorted or cliked?

I tried this but this didn't work.

    Protected Sub GridView1_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Sorted

createchart()

    End Sub



Toshiyuki Saito
Post #7009
Posted 6/26/2008 5:41:24 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 11:57:55 PM
Posts: 630, Visits: 1,916
Hi Toshiyuki Saito,
  Please build the XML again in the "sorted" event and re-render the chart. You can call createchart() [where this XML building and re-rendering of chart occurs] from GridView1_Sorted event. In createchart() please read data from grid view control object rather than the datasource. Please see the code below for createChart() which  you might use and modify in our application.

----------------------------------------------------------------------

Protected Sub GridView1_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Sorted

CreateChart()

End Sub

-------------------------------------------------------------------------

Public Sub CreateChart()

Dim strXML As New StringBuilder()

strXML.Append("<chart>")

Dim i As Integer

For i = 0 To GridView1.Rows.Count - 1

strXML.Append("<set value='" & GridView1.Rows(i).Cells(1).Text & "' label='" & GridView1.Rows(i).Cells(0).Text & "' />")

Next

strXML.Append("</chart>")

Literal1.Text = FusionCharts.RenderChart("FusionCharts/Column2D.swf", "", strXML.ToString(), "ChartID", "350", "300", False, False)

End Sub

 



Thanks,
Arindam

FusionCharts Team
www.fusioncharts.com

Post #7041
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 12:01am


Execution: 0.094.