Commit Graph

15 Commits

Author SHA1 Message Date
Manuel
abb6f686a3 Initial implementation of "conditional formatting" (#1503)
After setting a filter, the user can select from the context menu in the
filter line a new option "Use for Conditional Format", that assigns
automatically a colour to the background of cells fulfilling that
condition.

The formatting is preserved after the user has removed the filter. Several
conditional formats can be successively added to a column using different
filters.

The conditional formats of a column can be cleared when the filter is empty
selecting "Clear All Conditional Formats" from the filter line context
menu.

The conditional formats are saved and loaded in project files as other
browse table settings.

A new class Palette has been added for reusing the automatic colour
assignment of the Plot Dock. It takes into account the theme kind of the
application (dark, light) for the colour selection.

A new class CondFormat for using the conditional formatting settings from
several classes. The conversion of a filter string from our format to an
SQL condition has been moved here for reuse in filters and conditional
formatting.

Whether the conditional format applies is resolved by SQLite, so filters
and conditional formats give the same exact results.

Code for getting a pragma value has been reused for getting the condition
result, and consequently renamed to selectSingleCell.

Possible future improvement:
- New dialog for editing the conditional formatting (at least colour and
application order of conditions, but maybe too: adding new conditions and
editing the condition itself).
2018-10-30 21:22:14 +01:00
Martin Kleusberg
fb1eba1391 Remove some virtuals and add some overrides
In our case this is more a question of code style.
2018-10-09 20:28:22 +02:00
mgr
79983e25cf Printing support #1525: plot printing using preview dialog
Add shortcut and entry in context menu for printing a plot.
2018-09-29 23:54:51 +02:00
mgrojo
5dbb7ff645 Ensure the Escape key doesn't make Plot and Remote docks go away
Override reject() as done in other dock dialogs.

Fixes #1310
2018-01-30 20:33:15 +01:00
mgrojo
c5ec23e92e Stacked or grouped bars and plot legend
Two new options added to the context menu of the plot:

- Stacked bars: switches between stacked bars or grouped bars. The former
overlapped layout is avoided since it doesn't make much sense.

- Show legend: toggles the display of a plot legend with a translucent
background. Possible future improvement is dragging the legend with the
mouse.
2018-01-21 17:00:45 +01:00
mgrojo
aa680622c0 Bar charts and Axis Type column in Plot Dock
String type columns are now selectable as X axis. In that case a bar chart
is plotted where the column values are used as bar labels.

A new Axis Type column is added to the axis selection table, so the user
knows before-hand how the plot will be drawn.

Line type and point shape combo-boxes are not enabled for bar charts, since
they don't make sense.

Columns that make no sense for the Y axis as strings and date/times are not
selectable for that axis.
2018-01-20 18:08:31 +01:00
mgrojo
33801d5285 Synchronize PlotDock with 'Execute SQL' table. Continuation of PR #1271
Make use of signals to connect the selection in plot to the associated
table widget. Every time that the plot is updated from the Main Window
the table widget associated to the table or query is connected to the plot
and the previous widget is disconnected. This allows the selection of the
correct table widget.

Line selection methods moved to the Extended Table Widget to be used as
slots for this connection.

The destroyed signal is also connected for resetting the plot. This fixes
a crash that already existed before this PR, when closing a SQL tab while
the plot is still associated to the table results model.
2018-01-16 00:37:42 +01:00
mgrojo
e34d36085d Copy plot to clipboard
New context menu and shortcut (context restricted to widget) for copying
the current plot to the clipboard as a pixmap.
2017-12-13 00:14:27 +01:00
mgrojo
5807c0be6b Allow zooming and dragging only in one orientation
By selecting the axis or the labels associated to the axis,the user can
restrict the subsequent zoom or drag operation to that orientation.

The possible user interactions are documented in the Whats's This
information.

See issue #1258
2017-12-08 20:12:07 +01:00
Martin Kleusberg
16263452c8 plot: Correctly restore Y axis check states
When restoring the plot state we always checked set the use-on-y-axis
checkbox when a colour was defined for a field. This is correct most of
the times because a field doesn't have a colour as long as it's not used
in the plot. However, when you uncheck a field it keeps its colour which
starts causing issues as soon these settings are reloaded.

The solution is to not only store the colour but also the check state
independently. This changes the project files format though, so the code
needs to support loading old and new file formats.

See issue #1245.
2017-12-01 13:03:48 +01:00
mgr
ade562769a Minor improvements in Plot Dock columns
The Column Field is resized to the content.

The dummy column has been removed and the header no longer stretches the
last section property.

The table has alternating row colors for easy following of the field
checks.
2017-11-13 23:59:36 +01:00
mgr
e8e5671588 Range of plot points can be selected in graph and in table
The user is now able of selecting a range of contiguous points in any of
the graphs of the plot, through rectangle selection or click in single
point. This selection triggers automatically the selection of the
corresponding lines in the browsed table. In this way the user can analyse
the plot in detail.

Two other minor improvements: spelling error fixed and the dummy column in
the plot selection table has now transparent foreground (intends to avoid
wondering of the user about what functionality provides this column).
2017-11-11 23:10:11 +01:00
Martin Kleusberg
ee32b3e4e1 Use nullptr where possible 2017-10-30 21:20:02 +01:00
Martin Kleusberg
22791e5b26 Fix possible build error 2017-03-18 21:21:07 +01:00
Martin Kleusberg
a6f2a7d9a0 Move plot code into a separate set of files
This cleans up the main window class a bit which was getting quite large
and a bit harder to maintain than necessary.

This commit also includes two minor fixes to the plot system:
- The plot widgets are now disabled when no database file is opened.
- The progress bar shown when fetching all data is now initialised with
the correct row numbers.

Other than that this commit should in theory not change any
functionality.
2017-01-13 18:00:39 +01:00