wpf 工具包图表 LineSeries DataPointStyle
我想添加没有点的 LineSeries
只是线。我想从代码而不是 xaml 动态地执行此操作。
我尝试使用以下代码执行此操作:
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.VisibilityProperty,Visibility.Hidden));
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
};
chart.Series.Add(series);
但是它不起作用;我仍然看到要点。
I want to add LineSeries
without points just lines. I want to do this dynamically from code not xaml.
I tried to do this with following code:
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.VisibilityProperty,Visibility.Hidden));
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
};
chart.Series.Add(series);
However it doesn't work; I still see the points.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在此处回答了类似的问题。
简而言之:
Visibility
属性不起作用,您应该将Template
属性设置为 null。更正的行:
I have answered a similar question here.
Briefly: the
Visibility
property won't work, you should set theTemplate
property to null.Corrected lines:
为了隐藏数据点,将宽度和高度设置为 0 相同。
In order to hide the data points set width and height to 0 of the same.