-
Notifications
You must be signed in to change notification settings - Fork 15
/
chart_options.txt
153 lines (123 loc) · 5.96 KB
/
chart_options.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
More Chart Options
------------------
It is now possible to get more chart (bars / lines /pies) options
inside ocelotgui.
The contents of this file have been copied to README, so this file will be removed eventually.
Build
-----
It is no longer necessary to bring in the Qwt library, although
cmake . -DOCELOT_QWT_INCLUDE=1
still will work. The same functionality is available without it.
The source code which has the feature is inside #if (OCELOT_CHART == 1) ... #endif,
or #if (OCELOT_CHART_OR_QCHART == 1) ... #endif, and this is the default.
Therefore the instructions for building are as described for
ocelotgui 2.3.0 in the README file.
SET ocelot_grid_chart=
----------------------
There is a new client-side statement
SET ocelot_grid_chart = 'literal' [WHERE clause];
After you've typed SET ocelot_grid_chart= the prompt/autocomplete list wil be
'BAR'
'LINE'
'PIE'
'BAR VERTICAL'
'BAR STACKED'
'BAR VERTICAL STACKED'
'BAR SUBGROUP BY VALUE % 3'
'PIE SUBGROUP BY VALUE % 3'
'BAR SUBGROUP BY LEFT(COLUMN_NAME, 2)'
'LINE SUBGROUP BY LEFT(COLUMN_NAME, 2)'
'PIE SUBGROUP BY LEFT(COLUMN_NAME, 2)'
[string]
and you can make your own combination for example
SET ocelot_grid_chart = 'BAR STACKED' SUBGROUP BY VALUE % 5';
The optional WHERE may include COLUMN_NAME | COLUMN_NUMBER | COLUMN_TYPE
(relational operator) (literal value), along with AND|OR, as is usual for
any client-side SET OCELOT_GRID_... statements. For example
SET OCELOT_GRID_chart = 'PIE' WHERE column_name < 'k';
SET ocelot_grid_chart=''; will cancel all previous uses of SET ocelot_chart_grid,
that is, it turns the feature off.
Shortcut key combinations
-------------------------
Alt+Shift+B causes SET ocelot_grid_chart='bar';
Alt+Shift+L causes SET ocelot_grid_chart='line';
Alt_Shift+P causes SET ocelot_grid_chart='pie';
Alt+Shift+N causes SET ocelot_grid_chart='';
As usual, it is possible to change the key combinations with
SET ocelot_shortcut... statements.
Groups
------
Charts make sense when representing numbers.
A "group" is any uninterrupted series of numbers in a result-set row.
For example, in
SELECT 'a',1,2,3.7,4,'b',5e1,6,'c';
the first group is 1,2,3.7,4 and the second group is 5e1,6.
(That is the default. to change the default, use a WHERE clause.)
Subgroups
---------
A group may be divided into subgroups.
Subgrouping is what decides how sampling is done within a group.
Different methods of subgrouping are appropriate for different
types of chart.
There is automatic subgrouping of pies because otherwise all
pie segments would have a single colour.
(Different subgroups have different colours.)
There is automatic subgrouping of lines because otherwise the
points of all lines would be in the same axis and there would
be no apparent movement. The automatic subgrouping in this case
is SUBGROUP BY LEFT(COLUMN_NAME,2) so it need not be specified.
Layout of a cell (copied from comments in the sourc code)
----------------
These are the components of pixmap, which has whole chart (after header, not including cell border)
+--------------------------------------------------+
| TOP |
|L | L|
|E | CANVAS E|
|F | G|
|T | E|
| | N|
| | D|
| _____________________________________________ |
| BOTTOM |
+--------------------------------------------------+
But if pixmap size is small we might cancel everything except the canvas.
chart canvas: this is a non-optional component, it haa the actual bar/line/pie chart.
LEFT: For vertical-bar or line has "values axis", for horizontal-bar has "sample axis", for pie has nothing. Text, rotated 90 degrees.
BOTTOM: For horizontal-bar or line has "values axis", for vertical-bar has "values axis", for pie has nothing. Text.
LEGEND: This is on the RIGHT. Icons and very short text.
TOP: text (not shown by default)
LEFT: text (shown by default as "samples" or "values")
LEFT LINE: a straight line between LEFT and canvas
BOTTOM: text (shown by default as "values" or "samples")
BOTTOM LINE: a straight line between canvas and BOTTOM
Value axis: Becomes next to LEFT or BOTTOM in a bar or line.
Sample axis: Becomes next to LEFT or BOTTOM in a bar or line.
It is possible to cancel or change any item except the canvas.
So a fuller statement of the SET syntax can be
SET ocelot_grid_chart = '
{BAR|LINE|PIE} currently default=bar if this is missing, but don't do it
[VERTICAL] default is horizontal
[STACKED] default is grouping
[TOP=value] default is null
[RIGHT=value|LEGEND|NULL] default is LEGEND
[LEFT=value|DEFAULT|NULL] default is DEFAULT
[BOTTOM=value|DEFAULT|NULL] default is DEFAULT
[AXIS=NULL|ALL] default is ALL, anything but NULL will make axes appear
'
WHERE condition];
For example, to supppress everything except the canvas with a vertical bar chart:
SET ocelot_grid_chart='BAR VERTICAL RIGHT=NULL LEFT=NULL BOTTOM=NULL AXIS=NULL';
For example, to add a top line along with the other components with a pie:
SET ocelot_grid_chart='PIE TOP=TOPPER';
Any item value might be truncated. An easy way to change width of a single chart
is to use long column names, that is, instead of saying SELECT 1, 2, 3; say
SELECT 1 AS really_long_column_name, 2, 3;
Effects of other settings
-------------------------
SET ocelot_grid_font=... affects what font the chart captions have.
SET ocelot_grid_cell_border_size=... affects the width of lines.
And other ocelot_grid settings may affect all cells including cells with charts.
Illustrations
-------------
Pictures showing effects are in a blog post:
http://ocelot.ca/blog/blog/2023/08/08/charts/