@@ -8,7 +8,7 @@ const lcjs = require('@lightningchart/lcjs')
8
8
const xydata = require ( '@lightningchart/xydata' )
9
9
10
10
// Extract required parts from LightningChartJS.
11
- const { lightningChart, AxisTickStrategies, LegendBoxBuilders , emptyLine, SolidFill, SolidLine, Themes } = lcjs
11
+ const { lightningChart, AxisTickStrategies, emptyLine, SolidFill, SolidLine, Themes } = lcjs
12
12
13
13
// Import data-generator from 'xydata'-library.
14
14
const { createOHLCGenerator, createProgressiveTraceGenerator } = xydata
@@ -50,15 +50,6 @@ chartOHLC
50
50
// height of the row becomes 2/3 of the whole view (default value for row height / column width is 1)
51
51
db . setRowHeight ( 0 , 2 )
52
52
53
- // Create a LegendBox for Candle-Stick and Bollinger Band
54
- const legendBoxOHLC = chartOHLC
55
- . addLegendBox ( LegendBoxBuilders . VerticalLegendBox )
56
- // Dispose example UI elements automatically if they take too much space. This is to avoid bad UI on mobile / etc. devices.
57
- . setAutoDispose ( {
58
- type : 'max-width' ,
59
- maxWidth : 0.3 ,
60
- } )
61
-
62
53
// Define function which sets Y axis intervals nicely.
63
54
let setViewNicely
64
55
@@ -143,14 +134,6 @@ const chartVolume = db.createChartXY({
143
134
chartVolume . getDefaultAxisX ( ) . setTickStrategy ( AxisTickStrategies . DateTime , ( tickStrategy ) => tickStrategy . setDateOrigin ( dateOrigin ) )
144
135
// Modify Chart.
145
136
chartVolume . setTitle ( 'Volume' )
146
- // Create a LegendBox as part of the chart.
147
- const legendBoxVolume = chartVolume
148
- . addLegendBox ( LegendBoxBuilders . VerticalLegendBox )
149
- // Dispose example UI elements automatically if they take too much space. This is to avoid bad UI on mobile / etc. devices.
150
- . setAutoDispose ( {
151
- type : 'max-width' ,
152
- maxWidth : 0.3 ,
153
- } )
154
137
155
138
// Create Y-axis for series (view is set manually).
156
139
const volumeAxisY = chartVolume
@@ -179,16 +162,12 @@ createProgressiveTraceGenerator()
179
162
} ) ) ,
180
163
)
181
164
. then ( ( data ) => {
182
- volume . add ( data )
165
+ volume . appendJSON ( data )
183
166
setViewNicely ( )
184
167
} )
185
168
186
169
//#endregion
187
170
188
- // Add series to LegendBox.
189
- legendBoxOHLC . add ( chartOHLC )
190
- legendBoxVolume . add ( chartVolume )
191
-
192
171
setViewNicely = ( ) => {
193
172
const yBoundsStock = { min : areaRange . getYMin ( ) , max : areaRange . getYMax ( ) , range : areaRange . getYMax ( ) - areaRange . getYMin ( ) }
194
173
const yBoundsVolume = { min : volume . getYMin ( ) , max : volume . getYMax ( ) , range : volume . getYMax ( ) - volume . getYMin ( ) }
0 commit comments