Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Chart Info Strips not visually refreshing
posted

I have a XamDataChart with three horizontal chartinfostrips that denote warning and action limits for the chart. I have a text box in which the users can alter the Start and End Y values for these strips.

The strips work well with the exception of one problem. I update the values of the strips but they dont actually visually refresh until I perform some sort of action on the chart such as zooming in or panning.

I am assuming this is because some refresh method needs to be called somewhere.

Thanks

Steve

Parents
  • 34810
    Offline posted

    Hello Steve,

    Thank you for your post.

    I am assuming that you are using the ChartInfoStripsBehavior as demonstrated here: http://es.infragistics.com/samples/wpf/data-chart/chart-info-strips. Please let me know if this is not the case, as the following goes off of that assumption.

    Currently, the reason that the XamDataChart's info strips are not updating is because there isn't anything to tell them to update. There is a method that exists on the ChartInfoStripsBehavior called RefreshStrips. This is called whenever an InfoStrip is added or removed from the info strip collection attached to the XamDataChart, when the axis the strip is related to has its size change in some way, or when the XamDataChart's WindowRect property changes or when the XamDataChart's size changes. The actual start and end X and Y values of the InfoStrips are also currently just regular double properties, and are not currently hooking into any particular "property changed" type of event.

    My recommendation to you is to modify this ChartInfoStripsBehavior as well as the actual InfoStrips class. I would recommend that you begin by creating an internal property on the InfoStrip class of type ChartInfoStripsBehavior, so that each InfoStrip in your XamDataChart has a reference back to its owning ChartInfoStripsBehavior. Then, in the OnStripsCollectionChanged handler of the ChartInfoStripsBehavior, you can catch the InfoStrips objects as they are added to the collection that will be shown in the XamDataChart. This will allow you to set this new behavior property to "this." This will allow you to access the public Refresh method from the InfoStrips class, which calls the RefreshStrips method.

    The other modifications that would now need to be made are to remove the StartX, EndX, StartY, and EndY double properties in favor of a dependency property for each one. Doing this will allow you to hook into a property changed event for each of those properties that will fire when one of the corresponding values changes. Since you now have a reference to the ChartInfoStripsBehavior via the internal property mentioned above, you can cast the DependencyObject to an InfoStrip, and then call MyInfoStrip.OwningBehaviorInternalProperty.Refresh() to refresh the position of the InfoStrips when their Start or End X or Y properties change.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamDataChartValueOverlayMoveCase.zip
Reply Children