PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.9.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.9.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Gutenberg / src / Components / Sidebar / VerticalAxisSettings.js

VerticalAxisSettings.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.9.0, at classes/Visualizer/Gutenberg/src/Components/Sidebar/VerticalAxisSettings.js

266 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 const { __ } = wp.i18n;
5
6 const {
7 Component,
8 Fragment
9 } = wp.element;
10
11 const { ColorPalette } = wp.blockEditor || wp.editor;
12
13 const {
14 BaseControl,
15 ExternalLink,
16 PanelBody,
17 SelectControl,
18 TextControl
19 } = wp.components;
20
21 import { getColorCode } from '../../utils.js';
22
23 class VerticalAxisSettings extends Component {
24 constructor() {
25 super( ...arguments );
26 }
27
28 render() {
29
30 const type = this.props.chart['visualizer-chart-type'];
31
32 const settings = this.props.chart['visualizer-settings'];
33
34 return (
35 <PanelBody
36 title={ __( 'Vertical Axis Settings' ) }
37 initialOpen={ false }
38 className="visualizer-advanced-panel"
39 >
40
41 <PanelBody
42 title={ __( 'General Settings' ) }
43 className="visualizer-inner-sections"
44 initialOpen={ false }
45 >
46
47 <TextControl
48 label={ __( 'Axis Title' ) }
49 help={ __( 'The title of the Vertical axis.' ) }
50 value={ settings.vAxis.title }
51 onChange={ e => {
52 settings.vAxis.title = e;
53 this.props.edit( settings );
54 } }
55 />
56
57 <SelectControl
58 label={ __( 'Text Position' ) }
59 help={ __( 'Position of the Vertical axis text, relative to the chart area.' ) }
60 value={ settings.vAxis.textPosition ? settings.vAxis.textPosition : 'out' }
61 options={ [
62 { label: __( 'Inside the chart' ), value: 'in' },
63 { label: __( 'Outside the chart' ), value: 'out' },
64 { label: __( 'None' ), value: 'none' }
65 ] }
66 onChange={ e => {
67 settings.vAxis.textPosition = e;
68 this.props.edit( settings );
69 } }
70 />
71
72 <SelectControl
73 label={ __( 'Direction' ) }
74 help={ __( 'The direction in which the values along the Vertical axis grow.' ) }
75 value={ settings.vAxis.direction ? settings.vAxis.direction : '1' }
76 options={ [
77 { label: __( 'Identical Direction' ), value: '1' },
78 { label: __( 'Reverse Direction' ), value: '-1' }
79 ] }
80 onChange={ e => {
81 settings.vAxis.direction = e;
82 this.props.edit( settings );
83 } }
84 />
85
86 <BaseControl
87 label={ __( 'Base Line Color' ) }
88 >
89 <ColorPalette
90 value={ settings.hAxis.baselineColor }
91 onChange={ e => {
92 settings.hAxis.baselineColor = getColorCode( e );
93 this.props.edit( settings );
94 } }
95 />
96 </BaseControl>
97
98 <BaseControl
99 label={ __( 'Axis Text Color' ) }
100 >
101 <ColorPalette
102 value={ settings.vAxis.textStyle.color || settings.vAxis.textStyle }
103 onChange={ e => {
104 settings.vAxis.textStyle = {};
105 settings.vAxis.textStyle.color = getColorCode( e );
106 this.props.edit( settings );
107 } }
108 />
109 </BaseControl>
110
111 { ( -1 >= [ 'bar' ].indexOf( type ) ) && (
112 <Fragment>
113
114 <TextControl
115 label={ __( 'Number Format' ) }
116 help={ __( 'Enter custom format pattern to apply to Vertical axis labels.' ) }
117 value={ settings.vAxis.format }
118 onChange={ e => {
119 settings.vAxis.format = e;
120 this.props.edit( settings );
121 } }
122 />
123
124 <p>
125 { __( 'For number axis labels, this is a subset of the formatting ' ) }
126 <ExternalLink href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details">
127 { __( 'ICU pattern set.' ) }
128 </ExternalLink>
129 { __( ' For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.' ) }
130 </p>
131
132 <p>
133 { __( 'For date axis labels, this is a subset of the date formatting ' ) }
134 <ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
135 { __( 'ICU date and time format.' ) }
136 </ExternalLink>
137 </p>
138
139 </Fragment>
140 ) }
141
142 </PanelBody>
143
144 { ( -1 >= [ 'bar' ].indexOf( type ) ) && (
145
146 <Fragment>
147
148 <PanelBody
149 title={ __( 'Grid Lines' ) }
150 className="visualizer-inner-sections"
151 initialOpen={ false }
152 >
153
154 <TextControl
155 label={ __( 'Count' ) }
156 help={ __( 'The approximate number of vertical gridlines inside the chart area. You can specify a value of -1 to automatically compute the number of gridlines, 0 or 1 to draw no gridlines, or 2 or more to only draw gridline. Any number greater than 2 will be used to compute the minSpacing between gridlines.' ) }
157 value={ settings.vAxis.gridlines ? settings.vAxis.gridlines.count : '' }
158 onChange={ e => {
159 if ( ! settings.vAxis.gridlines ) {
160 settings.vAxis.gridlines = {};
161 }
162
163 settings.vAxis.gridlines.count = e;
164 this.props.edit( settings );
165 } }
166 />
167
168 <BaseControl
169 label={ __( 'Color' ) }
170 >
171 <ColorPalette
172 value={ settings.vAxis.gridlines ? settings.vAxis.gridlines.color : '' }
173 onChange={ e => {
174 if ( ! settings.vAxis.gridlines ) {
175 settings.vAxis.gridlines = {};
176 }
177
178 settings.vAxis.gridlines.color = e;
179 this.props.edit( settings );
180 } }
181 />
182 </BaseControl>
183
184 </PanelBody>
185
186 <PanelBody
187 title={ __( 'Minor Grid Lines' ) }
188 className="visualizer-inner-sections"
189 initialOpen={ false }
190 >
191
192 <TextControl
193 label={ __( 'Count' ) }
194 help={ __( 'Specify 0 to disable the minor gridlines.' ) }
195 value={ settings.vAxis.minorGridlines ? settings.vAxis.minorGridlines.count : '' }
196 onChange={ e => {
197 if ( ! settings.vAxis.minorGridlines ) {
198 settings.vAxis.minorGridlines = {};
199 }
200 settings.vAxis.minorGridlines.count = e;
201 this.props.edit( settings );
202 } }
203 />
204
205 <BaseControl
206 label={ __( 'Color' ) }
207 >
208 <ColorPalette
209 value={ settings.vAxis.minorGridlines ? settings.vAxis.minorGridlines.color : '' }
210 onChange={ e => {
211 if ( ! settings.vAxis.minorGridlines ) {
212 settings.vAxis.minorGridlines = {};
213 }
214 settings.vAxis.minorGridlines.color = e;
215 this.props.edit( settings );
216 } }
217 />
218 </BaseControl>
219
220 </PanelBody>
221
222 <PanelBody
223 title={ __( 'View Window' ) }
224 className="visualizer-inner-sections"
225 initialOpen={ false }
226 >
227
228 <TextControl
229 label={ __( 'Maximun Value' ) }
230 help={ __( 'The maximum vertical data value to render.' ) }
231 value={ settings.vAxis.viewWindow ? settings.vAxis.viewWindow.max : '' }
232 onChange={ e => {
233 if ( ! settings.vAxis.viewWindow ) {
234 settings.vAxis.viewWindow = {};
235 }
236 settings.vAxis.viewWindow.max = e;
237 this.props.edit( settings );
238 } }
239 />
240
241 <TextControl
242 label={ __( 'Minimum Value' ) }
243 help={ __( 'The minimum vertical data value to render.' ) }
244 value={ settings.vAxis.viewWindow ? settings.vAxis.viewWindow.min : '' }
245 onChange={ e => {
246 if ( ! settings.vAxis.viewWindow ) {
247 settings.vAxis.viewWindow = {};
248 }
249 settings.vAxis.viewWindow.min = e;
250 this.props.edit( settings );
251 } }
252 />
253
254 </PanelBody>
255
256 </Fragment>
257
258 )}
259
260 </PanelBody>
261 );
262 }
263 }
264
265 export default VerticalAxisSettings;
266