Hi,
i just wanted to test the chart and I placed a chart on XAML window without any changes.
Now do in code behind
chart.DataContext = myObservableCollection;
But nothing happens ...
Is there an easy how to ?
Hi, a good place to start would be our samples and help:
Here is an example of how to set up most of the category series:
http://samples.infragistics.com/sldv/RunSamples.aspx?cn=data-chart#/data-chart/category-series
and if you examine the help topic for any of the series types it will show the requirements for that type of series, and here is a general overview of data mapping: http://help.infragistics.com/NetAdvantage/DV/2011.1/CLR4.0/?page=xamDataChart_Data_Mapping.html
Let me know if you have further questions. Hope this helps!
-Graham
I got thta working, but meanwhile I#m stopping at the X-Axis.
I wanna have Labels on XAxis showing, but in general the x-axis is not showing.
I did nothing in xaml.
I just wanna do that in code behind.
CategoryXAxis xaxis = new CategoryXAxis(); AxisLabelSettings als = new AxisLabelSettings(); als.Visibility = System.Windows.Visibility.Visible; als.Location = AxisLabelsLocation.OutsideBottom; xaxis.LabelSettings = als; xaxis.ItemsSource = _devMin; xaxis.LabelSettings.Location = AxisLabelsLocation.OutsideBottom; igChart.Axes.Add(xaxis); AreaSeries a = new AreaSeries(); a.Name = "Toleranz_Min"; a.ItemsSource = _devMin; a.ValueMemberPath = "Y"; a.XAxis = xaxis; a.YAxis = yaxis; a.Brush = new LinearGradientBrush(Colors.Green, Colors.LightGreen, 90); a.Outline = Brushes.Red; a.BorderBrush = Brushes.Magenta; igChart.Series.Add(a);
_devmin is currently an ObservableCollection<CPoint> CPoint has x and Y properties which are nullable.
I also tried this with a collection havin X and Textlabel as string,but it does not work.
Second question:
How does it work to add legend completely in code behind?
Are there any samples?
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.
Hi Graham,
the axis is working. The legend I havn' yet tried.
I just wanted to try a few things in behavour on chart.
In general You are right.placing code in xaml.
hi,
You have to tell the x axis which property on the objects represents the label.
for example, if your label was a property called Label then you would do this:
xaxis.Label = "{Label}";
For the legend, you need to add it somewhere into the layout of the page, and then you can just assigne the instance of the legend to the chart's legend property.
igChart.Legend = theLegend.
If you are generating all the layout in the code behind (why?), you may want to instead generate a dock panel, put the chart and the legend in the dock panel, and adjust the docking options to preference. Alternatively you could use a grid, and put the chart and legend in different columns.
Hope this helps!