Skip to content

Feat: add logarithmic scale option for X and Y axes in Plot window#4158

Open
Negi2110 wants to merge 1 commit into
sqlitebrowser:masterfrom
Negi2110:feat/logarithmic-axis-plot
Open

Feat: add logarithmic scale option for X and Y axes in Plot window#4158
Negi2110 wants to merge 1 commit into
sqlitebrowser:masterfrom
Negi2110:feat/logarithmic-axis-plot

Conversation

@Negi2110

@Negi2110 Negi2110 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #4111

What this PR does

Adds logarithmic scale support for the X and Y axes in the Plot window,
accessible via two new options in the plot's right-click context menu:

  • "Logarithmic scale (X)"
  • "Logarithmic scale (Y)"

Implementation

Follows the same pattern as existing toggleable plot options
(Show legend, Stacked bars, Fixed number format):

  • Added m_logScaleX and m_logScaleY bool members to PlotDock
  • Added updateLogScale() function that calls QCPAxis::setScaleType()
    on xAxis, yAxis, and yAxis2
  • Added two checkable QAction entries to the context menu
  • Called updateLogScale() after rescaleAxes() in updatePlot() so
    the scale type is reapplied whenever the plot data changes
  • Guards against log(0): clamps axis range minimum to 1e-3 when
    switching to log scale with a non-positive lower bound

How to test

  1. Open a database with numeric data
  2. Go to Browse Data → Plot tab
  3. Select a numeric column as X and another as Y1
  4. Right-click the plot → toggle "Logarithmic scale (Y)"
  5. Y axis switches to logarithmic spacing
  6. Toggle off → returns to linear
  7. Same works for "Logarithmic scale (X)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Plot Window Logarithmic axis

1 participant