Windows 8 RadCartesianChart没有';由于某些点的空值,因此无法绘制
我使用Telerik RadCartesianChart,它的ItemSource绑定在ObservableCollection上 例如,它有3项: 值1=10 值2=空 值3=20 其StrokeMode=“AllButPlotLine” 由于空值,未绘制线。 我能画吗 关于,RadChart(RadCartesianChart)支持空(null/NaN)值。下面是一个使用MVVM模式的示例,供您探索。请注意,没有表示橙子的值 这里还有一个安装文件夹中的空值示例:C:\Program Files(x86)\Telerik\UI for Windows 8.1 XAML 2014年第2季度\Demos\Examples\Chart\EmptyValue MainPage.xamlWindows 8 RadCartesianChart没有';由于某些点的空值,因此无法绘制,windows-8,charts,telerik,windows-8.1,radchart,Windows 8,Charts,Telerik,Windows 8.1,Radchart,我使用Telerik RadCartesianChart,它的ItemSource绑定在ObservableCollection上 例如,它有3项: 值1=10 值2=空 值3=20 其StrokeMode=“AllButPlotLine” 由于空值,未绘制线。 我能画吗 关于,RadChart(RadCartesianChart)支持空(null/NaN)值。下面是一个使用MVVM模式的示例,供您探索。请注意,没有表示橙子的值 这里还有一个安装文件夹中的空值示例:C:\Program File
<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>
ViewModel.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; }
}
公共类视图模型
{
公共视图模型()
{
this.SeriesData=新列表()
{
新CustomPoint{Category=“Apples”,Value=10},
新CustomPoint{Category=“Oranges”},
新CustomPoint{Category=“Pears”,Value=15},
};
}
公共列表序列数据{get;set;}
}
这条线表示未绘制的值。。因为在你的例子中橙子没有价值。是你画的吗?
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; }
}