Vito De Tullio
Vito De Tullio

Reputation: 1685

set minor grid in a QCategoryAxis based chart

I have troubles using Qt's QCategoryAxis.

Preamble: I'm using this as a "poor man time axis", and I've created some code to basically define a new category for each first-of-the-month of the data I need to show.

It works fine, but now I have a grid with a column for each month. I want to have a 2-level grid: a major one each year and a minor one each month.

I know that the class support minorGrid* properties but the docs of the abstract class says:

Applies only to axes that support minor grid lines.

How do I know if QCategoryAxis supports minor grids? If it does, how do I make them visible? I only see "major" ones. If it doesn't (how I suppose) - is there a way to enhance QCategoryAxis to make it work?

FWIW: I'm writing a python application, using PySide (it's an internal app, so I may switch to PyQt if needed)

Upvotes: 3

Views: 127

Answers (1)

m7913d
m7913d

Reputation: 11072

Looking at the source code, reveals that minor axis are currently supported for 2 axis types:

  • QAbstractAxis::AxisTypeValue
  • QAbstractAxis::AxisTypeLogValue

For datetime and category axis, this feature isn't (yet) supported.

Note that it may be a good idea to submit a Qt bug report asking to update their documentation to include which axis types do actually support minor grid lines.

Upvotes: 2

Related Questions