Hi,
I am creating a chart dynamically with sometime more than 20000 nodes. I am facing very slow performance while rendring chart with displaytype.discrete for xaxis. but if i change displaytype =displaytype.continous then the performance gets increase. Could you tell me how to get same performance with displaytype.discrete for xaxis.
I can provide the sample application if required.
Hi Divya,
It has been around more than one week to get your reply back. could you please let me know what is the status of this query. if there is anything required from my side please let me know.
Please take it on priorty basis as i am stuck over it.
Thanks
Gourav
using System; using System.Collections; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using Infragistics.Controls.Charts; using System.Collections.ObjectModel; using System.Windows.Media; using System.Windows.Media.Media3D; using System.Linq; namespace XamDataChart_ShareXAxis { public partial class MainWindow : Window { public Random _rand = new Random(1001); public MainWindow() { InitializeComponent(); DrawChart(); } public class LicenseHighWaterMarkData { public DateTime Date { get; set; } public int MaxHighWaterMarkCheckOut { get; set; } } public void DrawChart( ) { Grid grid = new Grid(); RowDefinition gridRow1 = new RowDefinition(); XamDataChart chart=new XamDataChart(); RowDefinition gridRow2 = new RowDefinition(); ObservableCollection<LicenseHighWaterMarkData> collection=new ObservableCollection<LicenseHighWaterMarkData>(); var StartDate = new DateTime(1800, 01, 01); var EndDate = new DateTime(2020, 08, 01); var icount = 0; for (var date = StartDate; date <= EndDate; date = date.AddDays(1)) { icount++; collection.Add(new LicenseHighWaterMarkData() { Date = date,MaxHighWaterMarkCheckOut = _rand.Next(8) }); } gridRow2.Height = GridLength.Auto; grid.RowDefinitions.Add(gridRow1); grid.RowDefinitions.Add(gridRow2); long maxValue = (collection.OrderBy(x => x.MaxHighWaterMarkCheckOut).Reverse().FirstOrDefault() .MaxHighWaterMarkCheckOut); // collectionOrderBy = coll; var xAxis = new CategoryDateTimeXAxis() { ItemsSource = collection, DateTimeMemberPath = "Date", //bind x-axis value to collection property. DisplayType = TimeAxisDisplayType.Discrete, // Interval = new TimeSpan(3000,0,0,0), Label = "{Date:MM/dd/yy}", }; var max = (collection.ToList().OrderBy(x => x.MaxHighWaterMarkCheckOut).Reverse().FirstOrDefault() .MaxHighWaterMarkCheckOut); var yAxis = new NumericYAxis(); yAxis.MinimumValue = 0.0; yAxis.MaximumValue = max + 1; yAxis.Interval = maxValue > 20 ? maxValue / 5 : 2; var series = new LineSeries(); series.ValueMemberPath = "MaxHighWaterMarkCheckOut"; series.ItemsSource = collection; series.XAxis = xAxis; series.YAxis = yAxis; chart = new XamDataChart(); chart.Axes.Add(xAxis); chart.Axes.Add(yAxis); chart.Series.Add(series); chart.VerticalZoomable = true; chart.HorizontalZoomable = true; chart.VerticalZoombarVisibility = Visibility.Visible; chart.HorizontalZoombarVisibility = Visibility.Visible; Grid.SetRow(chart, 0); grid.Children.Add(chart); Grid1.Children.Add(grid); } } }
I have paste the same code as i was not able to attach the sample application. Please let me know if you still have any issue regarding the code.
Hello Tej,
Thank you for posting. In order to understand the scenario about how you dynamically creating the node and finding the performance difference with different display type mode , the best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally.
Looking forward to hear you back.
Sincerly,
Divya Jain