Hi,
I've implemented a chart with multiple areas (i get the percentages of the cpu's and add it to the chart data) but i have some problems:
XAml
Any ideas?
I've implemented a chart with multiple areas (i get the percentages of the cpu's and add it to the chart data) but i have some problems:
- How can i add a fixed Y-axis (0-100 major tick 10 minor 5) because now it's dynamic (changes if value is greater or smaller then axis)
- How can i make the X-axis start at 0 because now i've got a gap between the first value and the Y-axis (because Y is always 1 as start)
- How can i remove the label on the points displaying the value
Code for populating the chart:
DataSeries splineAreaSeriesCPU1 = null; |
DataSeries splineAreaSeriesCPU2 = null; |
public void fillProcessorChart() |
{ |
splineAreaSeriesCPU1 = new DataSeries(); |
splineAreaSeriesCPU2 = new DataSeries(); |
splineAreaSeriesCPU1.Definition = new SplineAreaSeriesDefinition(); |
splineAreaSeriesCPU2.Definition = new SplineAreaSeriesDefinition(); |
ChartArea1.DataSeries.Add(splineAreaSeriesCPU1); |
ChartArea2.DataSeries.Add(splineAreaSeriesCPU2); |
} |
public static void FillWithSampleData(DataSeries series, double PcValue) |
{ |
series.Add(new DataPoint { XValue = series.Count() , YValue = PcValue }); |
if (series.Count()>10) |
series.RemoveAt(0); |
} |
XAml
<telerik:RadChart x:Name="RadChart1" Margin="8,8,8,8" Grid.Row="3" Grid.Column="2" UseDefaultLayout="False" VirtualizingStackPanel.VirtualizationMode="Recycling"> |
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
<Grid.RowDefinitions> |
<RowDefinition Height="0.5*" /> |
<RowDefinition Height="0.5*" /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*" /> |
</Grid.ColumnDefinitions> |
<telerik:ChartArea Grid.Row="0" x:Name="ChartArea1" > |
<telerik:ChartArea.AxisY> |
<telerik:AxisY MajorGridLinesVisibility="Collapsed" |
MinorTicksVisibility="Visible" |
Title="CPU 1" /> |
</telerik:ChartArea.AxisY> |
</telerik:ChartArea> |
<telerik:ChartArea Grid.Row="1" x:Name="ChartArea2" > |
<telerik:ChartArea.AxisY> |
<telerik:AxisY MajorGridLinesVisibility="Collapsed" |
MinorTicksVisibility="Visible" |
Title="CPU 2" /> |
</telerik:ChartArea.AxisY> |
</telerik:ChartArea> |
</Grid> |
</telerik:RadChart> |
Any ideas?