-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Hi,
I'm attaching a minimal example of a chart with two panes:
candlesticks for the price,
a histogram for the volume.
I want to set different scale margins for the price pane and the volume pane.
However, when I try to do that (you can reproduce the issue if you uncomment the corresponding lines in the code), the volume axis disappears.
Could you please help me understand how I can assign different scale margins to the price and volume panes while keeping the axis labels visible on both panes?
Below are the code sample and two screenshots that demonstrate the issue.
Thank you!
async function main() {
const chart = LightweightCharts.createChart(
document.getElementById("container"),
{
width: window.innerWidth,
height: window.innerHeight,
}
);
const candleSeries = chart.addSeries(
LightweightCharts.CandlestickSeries,
{}
);
const volumeSeries = chart.addSeries(
LightweightCharts.HistogramSeries,
{
//priceScaleId: 'volume-scale',
priceFormat: {
type: "volume",
},
},
1
);
candleSeries.setData([
{ time: "2018-10-19", open: 75, high: 82.8, low: 70, close: 80 },
{ time: "2018-10-22", open: 77, high: 88, low: 73, close: 86 },
{ time: "2018-10-23", open: 87, high: 90, low: 80, close: 89.5 },
{ time: "2018-10-24", open: 90, high: 92, low: 65, close: 69 },
{ time: "2018-10-25", open: 70, high: 72, low: 65, close: 67.4 },
]);
volumeSeries.setData([
{ time: "2018-10-19", value: 522000 },
{ time: "2018-10-22", value: 1500000 },
{ time: "2018-10-23", value: 700500 },
{ time: "2018-10-24", value: 2100000 },
{ time: "2018-10-25", value: 900900 },
]);
/*
candleSeries.priceScale().applyOptions({ scaleMargins: { top: 0.2, bottom: 0.1 } });
chart.priceScale('volume-scale').applyOptions({
visible: true,
scaleMargins: { top: 0.0, bottom: 0.0 },
borderVisible: true,
});
*/
chart.timeScale().fitContent();
}
main();Metadata
Metadata
Assignees
Labels
No labels