| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
const { __ } = wp.i18n; |
| 5 |
|
| 6 |
const { Component } = wp.element; |
| 7 |
|
| 8 |
const { |
| 9 |
PanelBody, |
| 10 |
SelectControl, |
| 11 |
TextControl |
| 12 |
} = wp.components; |
| 13 |
|
| 14 |
class BarsSettings extends Component { |
| 15 |
constructor() { |
| 16 |
super( ...arguments ); |
| 17 |
} |
| 18 |
|
| 19 |
render() { |
| 20 |
|
| 21 |
const settings = this.props.chart['visualizer-settings']; |
| 22 |
|
| 23 |
return ( |
| 24 |
<PanelBody |
| 25 |
title={ __( 'Bars Settings' ) } |
| 26 |
initialOpen={ false } |
| 27 |
className="visualizer-advanced-panel" |
| 28 |
> |
| 29 |
|
| 30 |
<SelectControl |
| 31 |
label={ __( 'Focus Target' ) } |
| 32 |
help={ __( 'The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click.' ) } |
| 33 |
value={ settings.focusTarget ? settings.focusTarget : 'datum' } |
| 34 |
options={ [ |
| 35 |
{ label: __( 'Focus on a single data point.' ), value: 'datum' }, |
| 36 |
{ label: __( 'Focus on a grouping of all data points along the major axis.' ), value: 'category' } |
| 37 |
] } |
| 38 |
onChange={ e => { |
| 39 |
settings.focusTarget = e; |
| 40 |
this.props.edit( settings ); |
| 41 |
} } |
| 42 |
/> |
| 43 |
|
| 44 |
<SelectControl |
| 45 |
label={ __( 'Is Stacked' ) } |
| 46 |
help={ __( 'If set to yes, series elements are stacked.' ) } |
| 47 |
value={ settings.isStacked ? settings.isStacked : '0' } |
| 48 |
options={ [ |
| 49 |
{ label: __( 'Yes' ), value: '1' }, |
| 50 |
{ label: __( 'No' ), value: '0' } |
| 51 |
] } |
| 52 |
onChange={ e => { |
| 53 |
settings.isStacked = e; |
| 54 |
this.props.edit( settings ); |
| 55 |
} } |
| 56 |
/> |
| 57 |
|
| 58 |
<TextControl |
| 59 |
label={ __( 'Bars Opacity' ) } |
| 60 |
help={ __( 'Bars transparency, with 1.0 being completely opaque and 0.0 fully transparent.' ) } |
| 61 |
value={ settings.dataOpacity } |
| 62 |
onChange={ e => { |
| 63 |
settings.dataOpacity = e; |
| 64 |
this.props.edit( settings ); |
| 65 |
} } |
| 66 |
/> |
| 67 |
|
| 68 |
</PanelBody> |
| 69 |
); |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
export default BarsSettings; |
| 74 |
|