Profile Picture

Chart is not updating

Posted By Devin Ellis 6 Years Ago
Author
Message
Devin Ellis
Problem Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 9, Visits: 81
In WPF, we have a grid where each row is the name of a chart and beside that a tab control.
When a grid row is clicked we select the appropriate grid tab, as the currently viewed tab, and initialize the chart (which is displayed 
in an NChartControl). After the chart is initialized we call Refresh on the NChartControl. We do this because there
can be a number of charts and we don't want them all to be initialized on startup of the view because of the time
it takes. So by initializing and refreshing when the chart is made viewable we minimize startup time of the view.
This only works on the first tab that is brought up, the rest of the tabs just show an empty chart control.
What is wrong with this approach? Note: we have tried InvalidateVisual on the chart control and that does not help either.





Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 8 hours ago
Posts: 3,054, Visits: 4,009
Hi Devin,
Can you send us an app that replicates the problem for review?

Best Regards,
Nevron Support Team



Devin Ellis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 9, Visits: 81
I am attaching a small example that shows the problem

Attachments
NevronTest.zip (293 views, 82.00 KB)
Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 8 hours ago
Posts: 3,054, Visits: 4,009
Hi Devin,

The problem we spotted are: 
1. The code that configures the chart clears the chart panels but does not add chart to the panels collection, leading to a chart control without any content (SetupChartControl). This was also leading to null reference exception in SetutChartAxes 
2. The code that feeds the data (GraphData) is called with a null argument for series (StudyData) so no series are added to the chart. 
You need to revise the code that feeds data to the chart as currently in case there is null data the code creates some dummy data: 
public virtual NLineSeries GraphData ( NChart chart, StudyData series, System.Drawing.Color lineColor ) 

if ( chart == null ) 

return null; 

if ( series == null ) 

series = new NevronTest.StudyData(); // previously exiting here! 

if ( series.Points == null || series.Points.Count == 0 ) 

return null; 

Regarding the null reference exception - this is caused because the control tries to read the registry in order to obtain a license key, but does not have permissions - this exception is handled and is not a problem. 
Hope this helps - let us know if you meet any problems or have any questions.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic