Home Forums WinForms controls Xceed Chart for WinForms How to specify color to a Series derived legend.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19183 |

    I would like to control the colors used for specific value ranges; I have defined NumericScale custom steps and want to specify color for each range defined.  e.g. 95-100% = red.

    <MeshSurfaceSeries instance

    >.Legend.Mode = SeriesLegendMode.SeriesLogic;

     Can anyone help?

     Thanks,

    Sam

    Imported from legacy forums. Posted by Sam (had 1330 views)

    User (Old forums)
    Member
    Post count: 23064

    No responses but eventually figured it out.

    MeshSurfaceSeries meshSeries = (MeshSurfaceSeries)Chart.Series[0];
    meshSeries.AutomaticPalette = false;
    meshSeries.Palette.Add(0, Color.White);
    meshSeries.Palette.Add(0, Color.Blue);
    meshSeries.Palette.Add(25, Color.BlueViolet);
    meshSeries.Palette.Add(50, Color.Purple);
    meshSeries.Palette.Add(75, Color.YellowGreen);
    meshSeries.Palette.Add(85, Color.Yellow);
    meshSeries.Palette.Add(90, Color.Orange);
    meshSeries.Palette.Add(95, Color.OrangeRed);
    meshSeries.Palette.Add(100, Color.Red);

    Companion snippet: set custom gridlines correlating to the above colors

    Chart.Axis(StandardAxis.PrimaryY).NumericScale.MajorTickMode
        = Xceed.Chart.Core.MajorTickModeNumeric.IrregularSteps;
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Clear();
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.Max = 100;

    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)25);// 25%
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)25);// 50%
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)25);//75
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)10);//85
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)05);//90
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)05);//95
    Chart.Axis(StandardAxis.PrimaryY).NumericScale.CustomSteps.Add((double)05);//100

    Imported from legacy forums. Posted by Sam (had 1259 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.