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
1730
Scatter chart plot color
posted

Hi,

I am using Scatter chart, where in I want to change the color of datapoint plot.

By default, data points are plotted using BLUE color

I tried to change color using Brush property as shown below:

@(Html.Infragistics().DataChart(dataSeries.AsQueryable())
                           
                            .VerticalZoomable(true)
                            .HorizontalZoomable(true)
                            .Axes((axes) =>
                            {
                                axes.NumericX("xAxis");
                                axes.NumericY("yAxis");
                            })

                            .Series(series =>
                            {
                                series.Scatter("scatterSeries")
                                    .XAxis("xAxis").Brush("Black")
                                    .YAxis("yAxis").Brush("Black")
                                   
                                    .XMemberPath(dataPoint => dataPoint.X)
                                    .YMemberPath(dataPoint => dataPoint.Y)
                                    .Legend(legend => legend.ID("legend").Width("140px"))
                                   
                            })
                            .DataBind()
                            .Render()
                        )

But it's still plotting in BLUE color.

 

 

  • 1775
    Suggested Answer
    posted

    Hi, sanjaysutar

    The correct option for your use case is markerBrush since in scatter plot the chart is actually displaying only markers. Hence the MVC helper function to use in your case is MarkerBrush(), like here:   

    1. .Series((series) =>
    2. {
    3.     series
    4.     .Scatter("series1")
    5.     .XAxis("xAxis").YAxis("yAxis")
    6.     .MarkerBrush("black")
    7.     .XMemberPath((item) => item.Index)
    8.     .YMemberPath((item) => item.Value1);
    9. })

     Cheers, Lazar