ScottPlot icon indicating copy to clipboard operation
ScottPlot copied to clipboard

SP5: Grid needs axis-specific customization of styling

Open bjschwarz opened this issue 2 years ago • 1 comments

I see that in SP4 it was possible to adjust the visibility of vertical and horizontal grid lines like this https://scottplot.net/cookbook/4.1/recipes/axis_griddisableone/.

I am not seeing a way to do this in SP5. But I may be missing it.

5.0.20

 ScottPlot.Grids.DefaultGrid grid = BlazorPlot.Plot.GetDefaultGrid();
 grid.MajorLineStyle.Width = 1;
 grid.MajorLineStyle.Color = ScottPlot.Color.FromHex("#a0acb5");
 grid.YAxis.IsVisible = false; 

Pretty sure grid.YAxis controls only the YAxis border.

Fantastic work on this library!

bjschwarz avatar Jan 24 '24 16:01 bjschwarz

Thanks so much for reporting this @bjschwarz! This is definitely a deficiency of the current grid architecture. Luckily I was planning on refactoring the grid system in the next few days (#3291) so when I do that I'll make sure it's possible to individually enable/style vertical vs. horizontal grid lines and I'll follow-up here when that work is complete 👍

swharden avatar Jan 25 '24 01:01 swharden

We used in the past the previous version (SP4) of this awesome library.. We are moving to the SP5 but one of the main issues with we are fighting is the impossibility to customize the grid... in our case the main request is the possibility to disable the vertical grid lines.

PaxITIS avatar Feb 27 '24 14:02 PaxITIS

Following-up, I'm about to merge #3497 which allows axis-specific grid customization. I intend to publish an updated package to NugGet later today. Thanks again for your suggestions!

myPlot.Add.Signal(Generate.Sin(51));
myPlot.Add.Signal(Generate.Cos(51));

myPlot.Grid.XAxisStyle.MajorLineStyle.Color = Colors.Magenta.WithAlpha(.1);
myPlot.Grid.XAxisStyle.MajorLineStyle.Width = 5;

myPlot.Grid.YAxisStyle.MajorLineStyle.Color = Colors.Green.WithAlpha(.3);
myPlot.Grid.YAxisStyle.MajorLineStyle.Width = 2;

image

swharden avatar Mar 17 '24 17:03 swharden