Hi,
I am using xamchart to display multiple series on the same graph. But at some points in different series, I dont have any data or NAN (Not a number ) Data to display which is halting my GUI. Is there any such feature so that i can display broken series. Please suggest solution.
Thanks.
You could try setting those DataPoint's NullValue property to true.
One way to approach it is to make sure you are using nulls rather than double.nan.
For a line series this:
var hasNaNs = from val in Enumerable.Range(0, 20) select new { Label = val.ToString(), Value = val % 5 == 0 ? double.NaN : val }; DataContext = from item in hasNaNs select new { Label = item.Label, Value = double.IsNaN(item.Value) ? null : new double?(item.Value) };
Results in this plot:
Let me know if this helps.
-Graham
Hi Graham,
Thanks for your reply and help. But I am not sure about the solution coze i tried it in this way and finding the following exception while assigning null value to my field
Data Binding Error - Invalid binding property name. Check DataMapping format string.
Before doing so it was working fine only instead of putting null i was putting 0.0 value when i found NAN in my data.
Can you please suggest any thing in this regard.
MoreOver! I am binding my collection on runtime with and providing Datamaping string:
Which version of the chart are you using? And is it possible for you to share a small code example of what you are trying to do and I should be able to point out anything that is wrong.
the bug was fixed on July 16, after the source code for that service release was frozen. the fix will most likely appear in the next service release.
Infragistics Developer Support may be able to provide this fix for you in an expedited manner. for more information, please contact our support department. http://infragistics.com/gethelp
Hi David Nengley,
I have updated my infragistics with latest release, made on 22 July. You in your previous reply said that this bug ill be fix in upcoming release. But it still persists is it fixed in this release or not and if not I need a quick fix for this problem. Please suggest some solution thanks.
don't forget there was a bug fix involved here (35931), so the issue won't be resolved until the next service release.
i'm not sure about the new exception based on the stack trace. do you have steps to reproduce or a sample for this?
Hi David,
Thanks for reply. It seems to work but its still not doing any thing for me. Well I already worked on this cross thread issue and dispatcher object. Its not sending any exception for simple values but its still throwning exception for Null values please find bellow the exception and stack trace:
StackTrace: at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
Source : mscorlib
I am already using this dispatcher object to notify my propertychange from other thread. Can you please suggest something for me.
i looked into this and was able to reproduce the exception, so i logged a bug and fixed it. the bug number is 35931. it should be resolved in an upcoming service release.
i did find two issues with your project, though.
first, you have a timer event updating the CurvePointY property, which in turn updates the chart due to INotifyPropertyChanged. since this is a UI operation, you need to ensure it happens on the UI thread. i modified the code like this:
foreach (Graph GraphItem in GraphCollection)
{
if (i % 5 == 0)
this.Parent.Dispatcher.Invoke(new Action(() => { GraphItem.CurvePointY = null; }));
else
this.Parent.Dispatcher.Invoke(new Action(() => { GraphItem.CurvePointY = GraphItem.CurvePointY + ((i / 5) * 2); }));
i++;
}
where this.Parent is a FrameworkElement passed to the GraphPresenter in its constructor...
this.DataContext = new GraphPresenter(this); // from Window1.xaml.cs
second, in the above code you'll notice i changed your i % 2 == 0 condition to i % 5 == 0. this is so you can see some lines drawn on the chart... because if only every second point is not null, then no lines can be drawn - a line requires at least two consecutive non-null points.