WPF Toolkit (February 2010 release) Chart with Column Series empty when ItemsSource has only one item

后端 未结 1 1030
执笔经年
执笔经年 2021-01-28 16:13

I\'m having an annoying problem: I have a simple Chart with one ColumnSeries and two axis (a LinearAxis for the dependent value and a DateTimeAxis for the independent one). My C

相关标签:
1条回答
  • 2021-01-28 16:39

    Glancing at the source code for ColumnSeries shows that the column width is related to the range of the data, which in your case is zero. Unless you want to fix bugs in the toolkit, the only workaround I can suggest is to surround your single point with dummy points to make it look like only one column is being shown:

            var now = DateTime.Now;
            Add(new DataPoint { Date = now, DependentValue = 5 });
            Add(new DataPoint { Date = now + TimeSpan.FromDays(1), DependentValue = 0 });
            Add(new DataPoint { Date = now - TimeSpan.FromDays(1), DependentValue = 0 });
    
    0 讨论(0)
提交回复
热议问题