File tree 3 files changed +22
-11
lines changed
3 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
import React , { Component } from 'react' ;
4
4
import {
5
5
connectToContainer ,
6
- customTraceToPlotlyTrace ,
6
+ traceTypeToPlotlyFigure ,
7
7
localize ,
8
8
plotlyTraceToCustomTrace ,
9
9
} from 'lib' ;
@@ -114,9 +114,10 @@ class TraceSelector extends Component {
114
114
}
115
115
116
116
updatePlot ( value ) {
117
- const update = customTraceToPlotlyTrace ( value ) ;
118
- if ( this . props . updateContainer ) {
119
- this . props . updateContainer ( update ) ;
117
+ const { updateContainer} = this . props ;
118
+
119
+ if ( updateContainer ) {
120
+ updateContainer ( traceTypeToPlotlyFigure ( value ) ) ;
120
121
}
121
122
}
122
123
Original file line number Diff line number Diff line change @@ -15,18 +15,28 @@ export function plotlyTraceToCustomTrace(trace) {
15
15
return trace . type ;
16
16
}
17
17
18
- export function customTraceToPlotlyTrace ( customTraceType ) {
19
- if ( customTraceType === 'line' ) {
18
+ export function traceTypeToPlotlyFigure ( traceType ) {
19
+ if ( traceType === 'line' ) {
20
20
return { type : 'scatter' , mode : 'lines' , fill : 'none' } ;
21
21
}
22
22
23
- if ( customTraceType === 'scatter' ) {
23
+ if ( traceType === 'scatter' ) {
24
24
return { type : 'scatter' , mode : 'markers' , fill : 'none' } ;
25
25
}
26
26
27
- if ( customTraceType === 'area' ) {
27
+ if ( traceType === 'area' ) {
28
28
return { type : 'scatter' , fill : 'tozeroy' } ;
29
29
}
30
30
31
- return { type : customTraceType } ;
31
+ if ( traceType === 'ohlc' ) {
32
+ return {
33
+ type : 'ohlc' ,
34
+ autobinx : true ,
35
+ autobiny : true ,
36
+ decreasing : { line : { color : '#7F7F7F' } } ,
37
+ increasing : { line : { color : '#17BECF' } } ,
38
+ } ;
39
+ }
40
+
41
+ return { type : traceType } ;
32
42
}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import tinyColor from 'tinycolor2';
13
13
import unpackPlotProps from './unpackPlotProps' ;
14
14
import walkObject , { isPlainObject } from './walkObject' ;
15
15
import {
16
- customTraceToPlotlyTrace ,
16
+ traceTypeToPlotlyFigure ,
17
17
plotlyTraceToCustomTrace ,
18
18
} from './customTraceType' ;
19
19
import * as PlotlyIcons from 'plotly-icons' ;
@@ -53,7 +53,7 @@ export {
53
53
connectToContainer ,
54
54
connectTraceToPlot ,
55
55
containerConnectedContextTypes ,
56
- customTraceToPlotlyTrace ,
56
+ traceTypeToPlotlyFigure ,
57
57
dereference ,
58
58
findFullTraceIndex ,
59
59
getDisplayName ,
You can’t perform that action at this time.
0 commit comments