@figlinq/react-chart-editor
Version:
plotly.js chart editor react component UI
2 lines • 6.84 kB
JavaScript
import PropTypes from"prop-types";import{Radio,TextEditor,TraceAccordion,Numeric,PlotlyFold,PlotlyPanel,PlotlySection,Dropdown,DropdownCustom,FontSelector,ColorPicker,VisibilitySelect,NumericOrDate,AxisInterval}from"../components";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const traceHasColorbar=(trace,fullTrace)=>fullTrace.marker&&fullTrace.marker.showscale!==undefined||fullTrace.showscale!==undefined;const StyleColorBarsPanel=(props,_ref)=>{let{localize:_}=_ref;return _jsx(TraceAccordion,{traceFilterCondition:traceHasColorbar,children:["","marker."].map(prefix=>{return _jsx(VisibilitySelect,{attr:prefix+"showscale",options:[{label:_("Show"),value:true},{label:_("Hide"),value:false}],showOn:true,children:_jsxs(PlotlyPanel,{children:[_jsxs(PlotlyFold,{name:_("Title"),children:[_jsx(TextEditor,{attr:prefix+"colorbar.title.text"}),_jsx(Dropdown,{label:_("Location"),attr:prefix+"colorbar.title.side",options:[{label:_("Top"),value:"top"},{label:_("Right"),value:"right"},{label:_("Bottom"),value:"bottom"}]}),_jsx(FontSelector,{label:_("Typeface"),attr:prefix+"colorbar.title.font.family"}),_jsx(Numeric,{label:_("Font Size"),attr:prefix+"colorbar.title.font.size",units:"px"}),_jsx(ColorPicker,{label:_("Font Color"),attr:prefix+"colorbar.title.font.color"})]}),_jsxs(PlotlyFold,{name:_("Size and Positioning"),children:[_jsxs(PlotlySection,{name:_("Size"),attr:prefix+"colorbar.len",children:[_jsx(Numeric,{label:_("Height"),attr:prefix+"colorbar.len"}),_jsx(Radio,{attr:prefix+"colorbar.lenmode",options:[{label:_("Fraction of Plot"),value:"fraction"},{label:_("Pixels"),value:"pixels"}]}),_jsx(Numeric,{label:_("Width"),attr:prefix+"colorbar.thickness"}),_jsx(Radio,{attr:prefix+"colorbar.thicknessmode",options:[{label:_("Fraction of Plot"),value:"fraction"},{label:_("Pixels"),value:"pixels"}]})]}),_jsxs(PlotlySection,{name:_("Horizontal Positioning"),attr:prefix+"colorbar.x",children:[_jsx(Numeric,{label:_("Position"),attr:prefix+"colorbar.x",showSlider:true,step:0.02}),_jsx(Dropdown,{label:_("Anchor"),attr:prefix+"colorbar.xanchor",options:[{label:_("Left"),value:"left"},{label:_("Center"),value:"center"},{label:_("Right"),value:"right"}]})]}),_jsxs(PlotlySection,{name:_("Vertical Positioning"),attr:prefix+"colorbar.y",children:[_jsx(Numeric,{label:_("Position"),attr:prefix+"colorbar.y",showSlider:true,step:0.02}),_jsx(Dropdown,{label:_("Anchor"),attr:prefix+"colorbar.yanchor",options:[{label:_("Top"),value:"top"},{label:_("Middle"),value:"middle"},{label:_("Bottom"),value:"bottom"}]})]}),_jsxs(PlotlySection,{name:_("Padding"),attr:prefix+"colorbar.xpad",children:[_jsx(Numeric,{label:_("Vertical"),attr:prefix+"colorbar.ypad",units:"px"}),_jsx(Numeric,{label:_("Horizontal"),attr:prefix+"colorbar.xpad",units:"px"})]})]}),_jsx(PlotlyFold,{name:_("Labels"),children:_jsxs(VisibilitySelect,{attr:prefix+"colorbar.showticklabels",options:[{label:_("Show"),value:true},{label:_("Hide"),value:false}],showOn:true,defaultOpt:true,children:[_jsx(FontSelector,{label:_("Typeface"),attr:prefix+"colorbar.tickfont.family"}),_jsx(Numeric,{label:_("Font Size"),attr:prefix+"colorbar.tickfont.size",units:"px"}),_jsx(ColorPicker,{label:_("Font Color"),attr:prefix+"colorbar.tickfont.color"}),_jsx(Dropdown,{label:_("Angle"),attr:prefix+"colorbar.tickangle",clearable:false,options:[{label:_("Auto"),value:"auto"},{label:_("45"),value:45},{label:_("90"),value:90},{label:_("135"),value:135},{label:_("180"),value:180}]}),_jsx(Dropdown,{label:_("Exponents"),attr:prefix+"colorbar.exponentformat",clearable:false,options:[{label:_("None"),value:"000"},{label:_("e+6"),value:"e"},{label:_("E+6"),value:"E"},{label:_("x10^6"),value:"power"},{label:_("k/M/G"),value:"SI"},{label:_("k/M/B"),value:"B"}]}),_jsx(DropdownCustom,{label:_("Label Prefix"),attr:prefix+"colorbar.tickprefix",options:[{label:_("None"),value:""},{label:_("x"),value:"x"},{label:_("$"),value:"$"},{label:_("#"),value:"#"},{label:_("@"),value:"@"},{label:_("Custom"),value:"custom"}],customOpt:"custom",dafaultOpt:"",clearable:false}),_jsx(Dropdown,{label:_("Show Prefix"),attr:prefix+"colorbar.showtickprefix",options:[{label:_("Every label"),value:"all"},{label:_("First label"),value:"first"},{label:_("Last label"),value:"last"},{label:_("None label"),value:"none"}]}),_jsx(DropdownCustom,{label:_("Label Suffix"),attr:prefix+"colorbar.ticksuffix",options:[{label:_("None"),value:""},{label:_("C"),value:"C"},{label:_("%"),value:"%"},{label:_("^"),value:"^"},{label:_("Custom"),value:"custom"}],customOpt:"custom",dafaultOpt:"",clearable:false}),_jsx(Dropdown,{label:_("Show Suffix"),attr:prefix+"colorbar.showticksuffix",options:[{label:_("Every label"),value:"all"},{label:_("First label"),value:"first"},{label:_("Last label"),value:"last"},{label:_("None label"),value:"none"}]}),_jsx(Radio,{attr:prefix+"colorbar.tickmode",options:[{label:_("Auto"),value:"auto"},{label:_("Custom"),value:"linear"}],label:_("Tick spacing")}),_jsx(NumericOrDate,{label:_("Step Offset"),attr:prefix+"colorbar.tick0"}),_jsx(AxisInterval,{label:_("Step Size"),attr:prefix+"colorbar.dtick"}),_jsx(Numeric,{label:_("Max Number of Labels"),attr:prefix+"colorbar.nticks"})]})}),_jsx(PlotlyFold,{name:_("Ticks"),children:_jsxs(VisibilitySelect,{attr:prefix+"colorbar.ticks",options:[{label:_("Inside"),value:"inside"},{label:_("Outside"),value:"outside"},{label:_("Hide"),value:""}],showOn:["inside","outside"],defaultOpt:"",children:[_jsx(Numeric,{label:_("Length"),attr:prefix+"colorbar.ticklen",units:"px"}),_jsx(Numeric,{label:_("Width"),attr:prefix+"colorbar.tickwidth",units:"px"}),_jsx(ColorPicker,{label:_("Color"),attr:prefix+"colorbar.tickcolor"}),_jsx(Radio,{attr:prefix+"colorbar.tickmode",options:[{label:_("Auto"),value:"auto"},{label:_("Custom"),value:"linear"}],label:_("Tick spacing")}),_jsx(NumericOrDate,{label:_("Step Offset"),attr:prefix+"colorbar.tick0"}),_jsx(AxisInterval,{label:_("Step Size"),attr:prefix+"colorbar.dtick"}),_jsx(Numeric,{label:_("Max Number of Labels"),attr:prefix+"colorbar.nticks"})]})}),_jsxs(PlotlyFold,{name:_("Borders and Background"),children:[_jsxs(PlotlySection,{name:_("Color Bar"),attr:prefix+"colorbar.outlinewidth",children:[_jsx(Numeric,{label:_("Border Width"),attr:prefix+"colorbar.outlinewidth"}),_jsx(ColorPicker,{label:_("Border Color"),attr:prefix+"colorbar.outlinecolor"})]}),_jsxs(PlotlySection,{name:_("Color Bar Container"),attr:prefix+"colorbar.bgcolor",children:[_jsx(ColorPicker,{label:_("Background Color"),attr:prefix+"colorbar.bgcolor"}),_jsx(Numeric,{label:_("Border Width"),attr:prefix+"colorbar.borderwidth"}),_jsx(ColorPicker,{label:_("Border Color"),attr:prefix+"colorbar.bordercolor"})]})]})]},prefix+" panel")},"x"+prefix)})})};StyleColorBarsPanel.contextTypes={localize:PropTypes.func};export default StyleColorBarsPanel;
//# sourceMappingURL=StyleColorbarsPanel.js.map