Is there a way to prevent the anti-aliasing on stepped line series? Given these are straight lines, it seems unnecessary, and makes some parts of the graph look significantly thicker than others:
Hello Campbell,
Thank you for contacting Infragistics. Please try setting the Resolution property to 0 on the chart or series, and increment by 1 as needed. If you don't see any improvements please attach a sample project demonstrating the behavior so I may investigate this further. Thank you.
Hi Michael.
Thanks for getting back to me. Unfortunately that doesn't appear to work.
Try the following:
void CreateNumericStepTimeSeriesChart(UltraDataChart chart) { // Axes var yAxis = new NumericYAxis(); var xAxis = new TimeXAxis { Label = "date", DataSource = dt2, DateTimeMemberPath = "date" };
chart.Axes.Add(xAxis); chart.Axes.Add(yAxis);
var stepLineSeries = new StepLineSeries { DataSource = dt2, ValueMemberPath = "Acct1", XAxis = xAxis, YAxis = yAxis, ShowDefaultTooltip = true, Brush = new SolidBrush(Color.Black), Resolution = 1 }; chart.Series.Add(stepLineSeries);
// Chart chart.Title = "Chart Title"; chart.Subtitle = "chart subtitle"; chart.IsHorizontalZoomEnabled = true; chart.DefaultInteraction = InteractionState.DragPan; }
with
dt2 = new AccountValueHistory();
public class AccountDateInfo { public DateTime date { get; set; }public decimal Acct1 { get; set; } public decimal Acct2 { get; set; } }
public AccountValueHistory() { this.Add(new AccountDateInfo { date = new DateTime(2023, 2, 10), Acct1 = 0, Acct2 = 30 }); this.Add(new AccountDateInfo { date = new DateTime(2023, 2, 16), Acct1 = -11.3M, Acct2 = 30}); this.Add(new AccountDateInfo { date = new DateTime(2023, 2, 25), Acct1 = 51, Acct2 = 60 }); this.Add(new AccountDateInfo { date = new DateTime(2023, 2, 26), Acct1 = 40, Acct2 = 60 }); this.Add(new AccountDateInfo { date = new DateTime(2023, 3, 1), Acct1 = 42.5M, Acct2 = 60 }); this.Add(new AccountDateInfo { date = new DateTime(2023, 3, 6), Acct1 = 30, Acct2 = 60 }); }
This results in the following chart:
I have zoomed in on sections to highlight the differences. As you can see, sometimes the width is exactly 2 pixels. Sometimes it's three, with antialiasing. I'm assuming you're trying to antialias because the line doesn't fit exactly between two values, but (a) it would be better to round to the nearest pixel to avoid the antialiasing, and (b) your antialiasing is too heavy, which makes the antialiased lines look way too thick.
Thank you for the sample. We're currently investigating this.
This is considered to be new product idea.
You can suggest new product ideas for future versions (or vote for existing ones) at <https://ko.infragistics.com/community/ideas>.
I will follow up if there is any remedy, you can set the thickness on the series to give the line more visibility.
Thanks Michael.
I agree that the option to disable anti-aliasing should be a new product idea, so I shall raise there. However, I think the overly heavy weighting of the anti-aliasing should be considered a bug. It just doesn't look right. It looks even more pronounced if I set line thickness to 1:
This just makes the graphs look unprofessional.