Skip to content

Commit 2aa654b

Browse files
committed
Update documentation
1 parent 0ac3f69 commit 2aa654b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The ChartContainer will contain all your charts.
3131
```javascript
3232
let chartContainer = new SimpleTimeChart.ChartContainer(
3333
"myChart", // Div ID of the containing the chart
34-
1300, // Width of the chart
34+
800, // Width of the chart
3535
70, // Axis Tickness
3636
{
3737
color: "#D0D0D0", // Color of axis text
@@ -50,9 +50,9 @@ let chart = chartContainer.newChart(
5050
500 // height of the Chart
5151
);
5252

53-
let secondChart = chartContainer.newChart(
54-
300 // height of the Chart
55-
);
53+
let secondChart = chartContainer.newChart(300);
54+
55+
let volumeChart = chartContainer.newChart(100);
5656
```
5757

5858
### Add Layers to Charts
@@ -74,6 +74,7 @@ let candlesticks = data.map(x => {
7474
})
7575
let pointList = candlesticks.map(x => {return {x: x.date.getTime(), y: x.weightedAverage}});
7676
let bandStepList = candlesticks.map(x => {return {x: x.date.getTime(), top: x.high, bottom:x.low}});
77+
let barList = candlesticks.map(x => {return {x: x.date.getTime(), y: x.volume, delta:deltaSecond * 1000}});
7778

7879
// Define all layers
7980
let candlestickLayer = new SimpleTimeChart.CandlestickLayer(candlesticks, {
@@ -92,11 +93,16 @@ let bandLayer = new SimpleTimeChart.BandLayer(bandStepList, {
9293
color: "#FFFFFF",
9394
opacity: 0.2,
9495
});
96+
let histLayer = new SimpleTimeChart.HistogramLayer(barList, {
97+
color: "#FFFFFF",
98+
opacity: 0.5,
99+
});
95100

96101
// Add Layers to the Chart you want
97102
chart.addLayer(candlestickLayer);
98103
secondChart.addLayer(lineLayer);
99104
secondChart.addLayer(bandLayer);
105+
volumeChart.addLayer(histLayer);
100106
```
101107

102108
### Set Scales
@@ -116,6 +122,9 @@ chart.setDataScale(
116122
secondChart.setDataScale(
117123
SimpleTimeChart.Util.getDataScaleFromLayer(secondChart, lineLayer)
118124
);
125+
volumeChart.setDataScale(
126+
SimpleTimeChart.Util.getDataScaleFromLayer(volumeChart, histLayer, 5) // 5 is the number of measure on the Y Axis
127+
);
119128
```
120129

121130
### Draw the result

www/main.js

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ let bandLayer = new SimpleTimeChart.BandLayer(bandStepList, {
4242
color: "#FFFFFF",
4343
opacity: 0.2,
4444
});
45-
4645
let histLayer = new SimpleTimeChart.HistogramLayer(barList, {
4746
color: "#FFFFFF",
4847
opacity: 0.5,

0 commit comments

Comments
 (0)