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 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
Hello dbishop9,
It's me again. :)
I followed the "getting started" topic in the help to come up with this code behind for creating the data (just as an example).
protected void Page_Load(object sender, EventArgs e) { this.UltraChart1.DataSource = GetColumnData(); this.UltraChart1.DataBind(); } private DataTable GetColumnData() { DataTable mydata = new DataTable(); mydata.Columns.Add("Series Labels", typeof(string)); mydata.Columns.Add("XValue", typeof(int)); mydata.Columns.Add("YValue", typeof(int)); mydata.Rows.Add(new Object[] { "Mercury", 5, 20 }); mydata.Rows.Add(new Object[] { "Venus", 10, 20 }); mydata.Rows.Add(new Object[] { "Earth", 15, 20 }); mydata.Rows.Add(new Object[] { "Mars", 20, 20 }); return mydata; }
Then I did what Swetha suggested. I set the Column value differently each time, but I'm not sure that it matters. Setting the Visible property on each item might be the key. Here's how it appeared in the .aspx page.
<ChartText> <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="0" ItemFormatString="Mercury" Row="0" Visible="True" /> <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="10" ItemFormatString="Venus" Row="1" Visible="True" /> <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="15" ItemFormatString="Earth" Row="2" Visible="True" /> <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="20" ItemFormatString="Mars" Row="3" Visible="True" /> </ChartText>
I hope that information helps you with setting it in the code behind.
I have attached a screenshot. I can upload my sample project if you'd like, but I simply explored the designer and property windows.
Elizabeth AlbertLocalization Engineer
Sorry, I have already done that, but it only displays the last item, not each one. Example below
chartText.Row = 0
chartText.Column = 0
chartText.ItemFormatString =
"AAAAA"
chartText.Row = 1
"BBBBB"
chartText.Row = 2
"cccCC"
chartText.VerticalAlign = StringAlignment.Far
iScatterChart.ScatterChart.ChartText.Add(chartText)
iScatterChart.ScatterChart.Icon = SymbolIcon.Circle
iScatterChart.ScatterChart.ChartText(0).Visible =
True
Thanks Swetha. Can you give me an example of dynamically creating the ChartText Collection & Chart Type Properties object? Thanks.
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