File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
src/components/containers Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,15 @@ import PlotlyPanel from './PlotlyPanel';
33import PropTypes from 'prop-types' ;
44import React , { Component } from 'react' ;
55import { connectTransformToTrace } from 'lib' ;
6+ import FoldEmpty from './FoldEmpty' ;
7+ import { PlotScatterIcon } from 'plotly-icons' ;
68
79const TransformFold = connectTransformToTrace ( PlotlyFold ) ;
810
911class TransformAccordion extends Component {
1012 render ( ) {
1113 const {
14+ fullContainer,
1215 fullContainer : { transforms = [ ] } ,
1316 localize : _ ,
1417 } = this . context ;
@@ -20,6 +23,15 @@ class TransformAccordion extends Component {
2023 { label : _ ( 'Aggregate' ) , type : 'aggregate' } ,
2124 ] ;
2225
26+ if ( [ 'scatter' , 'bar' , 'scattergl' ] . indexOf ( fullContainer . type ) === - 1 ) {
27+ return (
28+ < FoldEmpty
29+ icon = { PlotScatterIcon }
30+ messagePrimary = { _ ( 'No transforms available for this trace type' ) }
31+ />
32+ ) ;
33+ }
34+
2335 const filteredTransforms = transforms . filter ( ( { type} ) => Boolean ( type ) ) ;
2436 const content =
2537 filteredTransforms . length &&
Original file line number Diff line number Diff line change @@ -3,12 +3,15 @@ import PlotlyPanel from './PlotlyPanel';
33import PropTypes from 'prop-types' ;
44import React , { Component } from 'react' ;
55import { connectTransformToTrace } from 'lib' ;
6+ import FoldEmpty from './FoldEmpty' ;
7+ import { PlotScatterIcon } from 'plotly-icons' ;
68
79const TransformFold = connectTransformToTrace ( PlotlyFold ) ;
810
911class TransformAccordion extends Component {
1012 render ( ) {
1113 const {
14+ fullContainer,
1215 fullContainer : { transforms = [ ] } ,
1316 localize : _ ,
1417 container,
@@ -22,6 +25,29 @@ class TransformAccordion extends Component {
2225 { label : _ ( 'Aggregate' ) , type : 'aggregate' } ,
2326 ] ;
2427
28+ const transformableCharts = [
29+ 'scatter' ,
30+ 'bar' ,
31+ 'line' ,
32+ 'area' ,
33+ 'scattergl' ,
34+ 'box' ,
35+ 'histogram' ,
36+ 'histogram2d' ,
37+ 'histogram2dcontour' ,
38+ 'candlestick' ,
39+ 'ohlc' ,
40+ ] ;
41+
42+ if ( transformableCharts . indexOf ( fullContainer . type ) === - 1 ) {
43+ return (
44+ < FoldEmpty
45+ icon = { PlotScatterIcon }
46+ messagePrimary = { _ ( 'No transforms available for this trace type' ) }
47+ />
48+ ) ;
49+ }
50+
2551 const transformBy =
2652 container . transforms &&
2753 container . transforms . map ( tr => {
You can’t perform that action at this time.
0 commit comments