MJ27 Posted August 3, 2009 Report Share Posted August 3, 2009 Hi All, I am trying to access the chart data in javascript on clinet. At the server I have create a table with 3 columns: 1. valueofX 2. valueofY 3. Timedata I have associated this table with the chart: Chart.DataSource = dtTable; The column are mapped as follows: Chart.DataSourceSettings.Fields.Add(new FieldMap("valueofX", FieldUsage.XValue)); Chart.DataSourceSettings.Fields.Add(new FieldMap("valueofY", FieldUsage.Value)); Chart.DataSourceSettings.Fields.Add(new FieldMap("Timedata", FieldUsage.NotUsed)); Please note that I dont want the chart to use the data passed in"Timedata" column, hence i have assigned the field usage as'FieldUsage.NotUsed'. I have a link on each data point, when i click on this link a 'UserCommand' event is generate on client. This event pass the following parameters "obj, args". I can access the X and Y values for the chart using obj.Data.X.Item(<series>,<point>) obj.Data.Y.Item(<series>,<point>) How can I access the data in "Timedata" column on client side. Any help would be highly appreciated. Thanks, MJ Quote Link to comment Share on other sites More sharing options...
AndreG Posted August 3, 2009 Report Share Posted August 3, 2009 You can't access what you pass to the chart as NotUsed. But I might have a little work around that might work for you. In the BubbleChart sample (that comes with the installer), the "Symbol" column is passed as Label. Then, on a foreach loop passed to array of strings and the labels are cleared. Maybe you could do something similar, but instead of passing the values to a array of strings you could use the Tag property of Point. Then access it in obj.Point.Item(<point>).Tag. Let me know if that works for you. Quote Link to comment Share on other sites More sharing options...
MJ27 Posted August 13, 2009 Author Report Share Posted August 13, 2009 You can't access what you pass to the chart as NotUsed. But I might have a little work around that might work for you. In the BubbleChart sample (that comes with the installer), the "Symbol" column is passed as Label. Then, on a foreach loop passed to array of strings and the labels are cleared. Maybe you could do something similar, but instead of passing the values to a array of strings you could use the Tag property of Point. Then access it in obj.Point.Item(<point>).Tag. Let me know if that works for you. Thanks AndreG for your reply.I am getting the following property as 'undefined' error when accessing it in javascript. obj.Points.Item(0,0).Tag is undefined. How should I access this property. However I can access another property obj.Points.Items(0,0).Volume Order of execution: 1. Assign data to chart from a datatable. data table columns are mapped using the FieldMaps2. assign value to each Chart.Point[0,0].Tag 3. Draw chart. Thanks, MJ Quote Link to comment Share on other sites More sharing options...
AndreG Posted August 14, 2009 Report Share Posted August 14, 2009 Working for me. How did u pass the data to Tag? Chart.DataSourceSettings.Fields.Add(new FieldMap("valueofX", FieldUsage.XValue)); Chart.DataSourceSettings.Fields.Add(new FieldMap("valueofY", FieldUsage.Value)); Chart.DataSourceSettings.Fields.Add(new FieldMap("Timedata", FieldUsage.Label)); Chart1.DataSource = table1; int i = 0; foreach (string tag in Chart1.AxisX.Labels) { Chart1.Points[0, i].Tag = tag; i++; } Chart1.AxisX.Labels.Clear(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.