| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
const { __ } = wp.i18n; |
| 5 |
|
| 6 |
const { Component } = wp.element; |
| 7 |
|
| 8 |
const { ColorPalette } = wp.editor; |
| 9 |
|
| 10 |
const { |
| 11 |
BaseControl, |
| 12 |
PanelBody, |
| 13 |
TextControl |
| 14 |
} = wp.components; |
| 15 |
|
| 16 |
class ResidueSettings extends Component { |
| 17 |
constructor() { |
| 18 |
super( ...arguments ); |
| 19 |
} |
| 20 |
|
| 21 |
render() { |
| 22 |
|
| 23 |
const settings = this.props.chart['visualizer-settings']; |
| 24 |
|
| 25 |
return ( |
| 26 |
<PanelBody |
| 27 |
title={ __( 'Residue Settings' ) } |
| 28 |
initialOpen={ false } |
| 29 |
className="visualizer-advanced-panel" |
| 30 |
> |
| 31 |
|
| 32 |
<TextControl |
| 33 |
label={ __( 'Visibility Threshold' ) } |
| 34 |
help={ __( 'The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.' ) } |
| 35 |
placeholder={ __( '0.001388889' ) } |
| 36 |
value={ settings.sliceVisibilityThreshold } |
| 37 |
onChange={ e => { |
| 38 |
settings.sliceVisibilityThreshold = e; |
| 39 |
this.props.edit( settings ); |
| 40 |
} } |
| 41 |
/> |
| 42 |
|
| 43 |
<TextControl |
| 44 |
label={ __( 'Residue Slice Label' ) } |
| 45 |
help={ __( 'A label for the combination slice that holds all slices below slice visibility threshold.' ) } |
| 46 |
value={ settings.pieResidueSliceLabel } |
| 47 |
onChange={ e => { |
| 48 |
settings.pieResidueSliceLabel = e; |
| 49 |
this.props.edit( settings ); |
| 50 |
} } |
| 51 |
/> |
| 52 |
|
| 53 |
<BaseControl |
| 54 |
label={ __( 'Residue Slice Color' ) } |
| 55 |
> |
| 56 |
<ColorPalette |
| 57 |
value={ settings.pieResidueSliceColor } |
| 58 |
onChange={ e => { |
| 59 |
settings.pieResidueSliceColor = e; |
| 60 |
this.props.edit( settings ); |
| 61 |
} } |
| 62 |
/> |
| 63 |
</BaseControl> |
| 64 |
|
| 65 |
</PanelBody> |
| 66 |
); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
export default ResidueSettings; |
| 71 |
|