RadChart (RadCartesianChart)는 빈 (NULL/NaN의) 값들을 지원한다. 다음은 MVVM 패턴을 사용하여 탐색하는 예입니다. 오렌지 값은 표시되지 않습니다.
여기 설치 폴더에 빈 값의 예도 있습니다 : C : \ Program 파일 (x 86) \ Telerik \ UI 데모 \ 윈도우 8.1 XAML의 Q2 2014 \ 예 \ 차트 \의 EmptyValues
에서 MainPage.xaml
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<chart:RadCartesianChart Width="700" Height="700">
<chart:RadCartesianChart.Grid>
<chart:CartesianChartGrid MajorLinesVisibility="XY" StripLinesVisibility="Y">
<chart:CartesianChartGrid.MajorXLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#B45121"/>
<Setter Property="StrokeDashArray" Value="4,2"/>
</Style>
</chart:CartesianChartGrid.MajorXLineStyle>
<chart:CartesianChartGrid.MajorYLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#58622D"/>
<Setter Property="StrokeDashArray" Value="10,2"/>
</Style>
</chart:CartesianChartGrid.MajorYLineStyle>
</chart:CartesianChartGrid>
</chart:RadCartesianChart.Grid>
<chart:RadCartesianChart.DataContext>
<local:ViewModel/>
</chart:RadCartesianChart.DataContext>
<chart:RadCartesianChart.HorizontalAxis>
<chart:CategoricalAxis/>
</chart:RadCartesianChart.HorizontalAxis>
<chart:RadCartesianChart.VerticalAxis>
<chart:LinearAxis/>
</chart:RadCartesianChart.VerticalAxis>
<chart:LineSeries ItemsSource="{Binding SeriesData}">
<chart:LineSeries.CategoryBinding>
<chart:PropertyNameDataPointBinding PropertyName="Category"/>
</chart:LineSeries.CategoryBinding>
<chart:LineSeries.ValueBinding>
<chart:PropertyNameDataPointBinding PropertyName="Value"/>
</chart:LineSeries.ValueBinding>
</chart:LineSeries>
</chart:RadCartesianChart>
</Grid>
CustomPoint.cs는 파일
public class CustomPoint
{
public string Category { get; set; }
public double Value { get; set; }
}
바이올렛 ewModel.cs
public class ViewModel
{
public ViewModel()
{
this.SeriesData = new List<CustomPoint>()
{
new CustomPoint{ Category = "Apples", Value = 10 },
new CustomPoint{ Category = "Oranges"},
new CustomPoint{ Category = "Pears", Value = 15 },
};
}
public List<CustomPoint> SeriesData { get; set; }
}
줄은 그려지지 않은 값을 나타냅니다. 예를 들어 오렌지에서는 값이 없으므로. 그것은 당신과 함께 그렸나요? –