Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TEDmk committed May 27, 2020
1 parent 0ac3f69 commit 2aa654b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The ChartContainer will contain all your charts.
```javascript
let chartContainer = new SimpleTimeChart.ChartContainer(
"myChart", // Div ID of the containing the chart
1300, // Width of the chart
800, // Width of the chart
70, // Axis Tickness
{
color: "#D0D0D0", // Color of axis text
Expand All @@ -50,9 +50,9 @@ let chart = chartContainer.newChart(
500 // height of the Chart
);

let secondChart = chartContainer.newChart(
300 // height of the Chart
);
let secondChart = chartContainer.newChart(300);

let volumeChart = chartContainer.newChart(100);
```

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

// Define all layers
let candlestickLayer = new SimpleTimeChart.CandlestickLayer(candlesticks, {
Expand All @@ -92,11 +93,16 @@ let bandLayer = new SimpleTimeChart.BandLayer(bandStepList, {
color: "#FFFFFF",
opacity: 0.2,
});
let histLayer = new SimpleTimeChart.HistogramLayer(barList, {
color: "#FFFFFF",
opacity: 0.5,
});

// Add Layers to the Chart you want
chart.addLayer(candlestickLayer);
secondChart.addLayer(lineLayer);
secondChart.addLayer(bandLayer);
volumeChart.addLayer(histLayer);
```

### Set Scales
Expand All @@ -116,6 +122,9 @@ chart.setDataScale(
secondChart.setDataScale(
SimpleTimeChart.Util.getDataScaleFromLayer(secondChart, lineLayer)
);
volumeChart.setDataScale(
SimpleTimeChart.Util.getDataScaleFromLayer(volumeChart, histLayer, 5) // 5 is the number of measure on the Y Axis
);
```

### Draw the result
Expand Down
1 change: 0 additions & 1 deletion www/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ let bandLayer = new SimpleTimeChart.BandLayer(bandStepList, {
color: "#FFFFFF",
opacity: 0.2,
});

let histLayer = new SimpleTimeChart.HistogramLayer(barList, {
color: "#FFFFFF",
opacity: 0.5,
Expand Down

0 comments on commit 2aa654b

Please sign in to comment.