Does anyone have some sample code for a simple scatter-line chart? I have done many of the 2D charts, but haven't done the scatter chart yet. I've seen one example of a scatter-line chart and can't get it to display. Any help would be greatly appreciated. My Y axis is min 0 & max 50 with a single increment of 25. My X Axis is Planets, with the various planets plotted on the chart (assigned values between 5 and 45). I get no errors, but I can't get it to display.
Hello dbishop9,
You can view our online samples here.
The sample in particular that might interest you is the scatter line chart sample.
You can view the code by clicking on the "Source Code" tab at the top.
Elizabeth Albert
Localization Engineer
In the ScatterLine sample you reference, the declaration Protected chartData1 As ChartDatagives an error, it does not recognize the type ChartData. I have included the Import refrences in the sample. Where is this type located? Thanks
Yes, please try to set the property after databinding. The sample does databinding before setting the property.
No good, still get index out of bounds. Here is how I am filling my data table:
dt.Columns.Add(
"label", GetType(String))
"column1", GetType(Double))
"column2", GetType(Double))
dt.Rows.Add(
New Object() {"datapoint a", 5, 20})
New Object() {"datapoint b", 7, 25})
New Object() {"datapoint c", 9, 35})
New Object() {"datapoint d", 11, 15})
New Object() {"datapoint e", 13, 28})
New Object() {"datapoint f", 15, 22})
New Object() {"datapoint g", 17, 22})
New Object() {"datapoint h", 19, 25})
New Object() {"datapoint i", 21, 33})
New Object() {"datapoint j", 23, 15})
New Object() {"datapoint k", 25, 28})
New Object() {"datapoint l", 27, 27})
New Object() {"datapoint m", 29, 20})
New Object() {"datapoint n", 31, 25})
New Object() {"datapoint o", 33, 31})
New Object() {"datapoint p", 35, 15})
New Object() {"datapoint q", 37, 28})
New Object() {"datapoint r", 39, 22})
iScatterChart.DataSource = dt
iScatterChart.DataBind()
iScatterChart.ScatterChart.ChartText(0).Visible = True
And of course, the "datapoint x" label is what I'm expecting to display.
Hello dbishop9, Attached is the sample on Scattered chart. In order to set the label for each datapoint please follow the steps below in VS design view:
Select igchart --> ScatterChat in properties --> ChartText collection -- > Add 'Chart Type Properties' --> and set 'ItemFormatString' with 'visible' to true.
Hope this helps. Please let me know if you have any questions.
Sincerely,
Swetha
Thanks Swetha. Can you give me an example of dynamically creating the ChartText Collection & Chart Type Properties object? Thanks.
Hello Daryl,
Here is the link that will give you more details on dynamically creating ChartText Collection and setting properties: <http://help.infragistics.com/NetAdvantage/ASPNET/2010.2/?page=Chart_Apply_Chart_Text_Labels.html>
Refer to the code on above link. You can add ChartText to other types of chart also.
Please let me know if you have any further questions with this matter.
Thanks,
Bhadresh