Problem

Steppy lines

Posted 6 months ago by Avatar Julian Thomas

Hi

I am not able to get a smooth line, it has descrete steps in it. I have tried with and without aggregation and they are still there. For example, if I use a pure sine wave, you can see the steps:

Without aggregation:

https://www.dropbox.com/s/mzlxk1l5lv5tfgn/Capture5.PNG?dl=0

With aggregation, the line just becomes 'bumpy':

https://www.dropbox.com/s/ceoqy3l70ftx2rd/Capture4.PNG?dl=0

It is as though only certain angles of line can be rendered (integer perhaps?)

code I am using:

Xaml:

<charts:XYChart IsLegendVisible="True" PaddingPercentage="0" LegendHorizontalPosition="LeftInside"
GridLineMajorVisibility="Y" Margin="73,64,36,47">
<charts:XYChart.SeriesStyleSelector>
<charts:SeriesPaletteStyleSelector>
<charts:Palette Kind="Roman"/>
</charts:SeriesPaletteStyleSelector>
</charts:XYChart.SeriesStyleSelector>

<charts:XYChart.YAxes>
<charts:XYDoubleAxis x:Name="yAxis" Position="FarEdge" AreMajorTicksVisible="True" Minimum="0.0" Maximum="80.0" TickMajorInterval="10.0" Title="Stock Value"/>
</charts:XYChart.YAxes>
<charts:LineSeries ItemsSource="{Binding ElementName=CTLiveMainWindow, Path=ChartData1}" YAxis="{Binding ElementName=yAxis}" Description="Cyberdyne" IsAggregationEnabled="True" YPath="Amount" XPath="Index" LineKind="Normal" Name="lineSeries"/>

</charts:XYChart>

c#:

Style style = new System.Windows.Style();
style.Setters.Add(new Setter(Shape.StrokeThicknessProperty, 1.0));
lineSeries.LineStyle = style;

for (int i = 0; i <= 1800; i++)
{
double value = Math.Sin(i / 100.0) * 40.0 + 40.0;
var newSalesData1 = new SalesData(DateTime.Now, value, i);
chartData1.Add(newSalesData1);
}

 

Thanks

Julian


Comments (1)

Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA

Hi Julian,

Thanks for reporting this.  It appears to be due to some optimizations we make to help reduce anti-aliasing of lines in general.  We round data points a tad to assist with that by default.

For the next build, we have added a XYAxisBase.UseDisplayOptimizations property that you'd want to set to false on both axes.  That will turn off our rounding and will make the lines smooth for this kind of scenario.


Actipro Software Support
Information The latest build of this product (2018.1 build 0670) was released 7 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.