Page 1 of 1
ViewXY: Where are my gridlines?
Posted: Thu Jul 17, 2014 3:11 pm
by greggorob64
I'm trying to get the simplest possible gridlines (vertical and horizontal). For the X Axis, im just calling MajorGrid.Visible=true, and its working just fine.
I cannot get the Y Axis to show gridlines (its overlayed Y-axes, with 1 visible at a time). I can get the minor to show up, but not major. What am I missing?
Thanks!
EDIT: It seems like the color is the issue. The X Axis has a gray color by default (which is good, it just 'works'). However the Y axis has its default color set to white\transparent (25,255,255,255). Its a strange difference...
Below I get no horizontal gridlines dispite all that code
Re: ViewXY: Where are my gridlines?
Posted: Fri Jul 18, 2014 4:21 pm
by ArctionJari
Hi.
Both X and Y axis' major grid's default color is 50,255,255,255. You can double-check this by using WinForms demo application's property grid. Open for example "Point line" and use property grid to add a new axis and check its values.
Sounds strange that you have different values. Can you double-check your code and if the problem doesn't go away, can you send a demo project that shows this behavior so we can debug it.
Re: ViewXY: Where are my gridlines?
Posted: Mon Jul 28, 2014 4:36 pm
by greggorob64
I figured out the issue, and it leads me to another question. My gridlines weren't showing because my X axis wasn't visible.
A follow up question: I need to have gridlines without a visible axis. Is there some way to accomplish this?
I know it doesn't make sense normally, but I have multiple charts stacked on top of each other; and only the bottom grid has a visible X axis.
Re: ViewXY: Where are my gridlines?
Posted: Thu Jul 31, 2014 7:28 pm
by ArctionPasi
You can leave the axis.Visible = true, and trick with other properties
Code: Select all
axis.MouseInteraction = false;
axis.AxisThickness = 0;
axis.LabelsVisible = false;
axis.MouseScaling = false;
axis.MajorDivTickStyle.Visible = false;
axis.MinorDivTickStyle.Visible = false;
axis.Title.Visible = false;
or you can just move the axis vertical position out of the chart area.
Code: Select all
chart.ViewXY.AxisLayout.XAxesAutoplacement = Off;
axis.Position = 1000;
Re: ViewXY: Where are my gridlines?
Posted: Wed Aug 06, 2014 4:18 pm
by greggorob64
Thanks Pasi!