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
30
ScatterPolygonSeries -ig:ScatterPolygonSeries.ShapeStyle control visiblity and stroke with binding for each polygon
posted

i am using XamDataChart with ScatterPolygonSeries series type.

i set the ItemSource - ItemsSource="{Binding SelectedRootItem.Children}" with binding 

<ig:ScatterPolygonSeries ItemsSource="{Binding SelectedRootItem.Children}" Name="ChildChart" RenderTransformOrigin="0.5,1"
XAxis="{Binding ElementName=XAxis}"
YAxis="{Binding ElementName=YAxis}"
ShapeMemberPath="Points"
Tag="{Binding SelectedChildItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Thickness="5" >

i want to control each item the ScatterPolygonSeries (Path object) to be with different color , meaning of the same ScatterPolygonSeries

i will have 2 polygons with different color. 

each item in  SelectedRootItem.Children is From custom type class "NodeViewModel".

i have tried to do some logic in code behind by remove and add again the Path object  to the RootCanvas   but with no success .

please Help

Tomer

  • 34430
    Offline posted

    Hello Tomer,

    In order to style the different polygons of the ScatterPolygonSeries, I would recommend utilizing the AssigningShapeStyle property of the series. In order to use this event, you need to “opt in” to it by setting the IsCustomShapeStyleAllowed property to true. From there, the event arguments can net you the underlying data item (shape) that the event is firing for, and you can change the color using the same event arguments by setting the Fill and Stroke properties.

    I am attaching 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.

    XamDataChartPolygonSeriesStyling.zip