You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi, no matter what values I change "maxValue", "minValue", "tickSize" or "minMove" to, my graph still looks completely the same. Thoughts? I am trying to change these variables to change the range of values on the y-axis, the resolution of y-axis values, as well as the increment size of the y-axis values.
// Apply price format options to the candlestick series
candleseries.applyOptions({
priceFormat: {
type: 'price',
precision: 4,
minMove: 0.0001,
},
});
// Calculate the time range of the data
const firstDataPoint = klinedata[0].time;
const lastDataPoint = klinedata[klinedata.length - 1].time;
const dataRange = lastDataPoint - firstDataPoint;
// Set the visible time range to include a buffer on both ends of the data range
const buffer = 0.1; // Adjust the buffer as needed
const visibleRange = dataRange * (1 + buffer);
chart.timeScale().setVisibleRange({
from: firstDataPoint - visibleRange,
to: lastDataPoint + visibleRange,
});
};
hi, no matter what values I change "maxValue", "minValue", "tickSize" or "minMove" to, my graph still looks completely the same. Thoughts? I am trying to change these variables to change the range of values on the y-axis, the resolution of y-axis values, as well as the increment size of the y-axis values.
Here is the code in javascript:
"const getData = async () => {
const res = await fetch('ohlcv_new.csv');
const resp = await res.text();
const cdata = resp.split('\n').map((row) => {
const [time1, open, high, low, close] = row.split(',');
return {
time: new Date(
${time1}
).getTime() / 1000,open: open * 1,
high: high * 1,
low: low * 1,
close: close * 1,
};
});
return cdata;
};
const displayChart = async () => {
const chartProperties = {
width: 1500,
height: 600,
timeScale: {
timeVisible: true,
secondsVisible: false,
rightOffset: 12, // Add a right offset to make room for the y-axis
},
priceScale: {
position: 'right', // Position of the price scale
mode: 0, // Normal mode
autoScale: false,
minValue: 0,
maxValue: 30.0000,
scaleMargins: {
top: 25,
bottom: 0.5,
},
minMove: 0.0001,
tickSize: 3.0000,
tickMarkFormatter: (tickValue, index, formatter) => {
return tickValue.toFixed(4);
},
},
};
const domElement = document.getElementById('tvchart');
const chart = LightweightCharts.createChart(domElement, chartProperties);
const candleseries = chart.addCandlestickSeries();
const klinedata = await getData();
candleseries.setData(klinedata);
// Apply price format options to the candlestick series
candleseries.applyOptions({
priceFormat: {
type: 'price',
precision: 4,
minMove: 0.0001,
},
});
// Calculate the time range of the data
const firstDataPoint = klinedata[0].time;
const lastDataPoint = klinedata[klinedata.length - 1].time;
const dataRange = lastDataPoint - firstDataPoint;
// Set the visible time range to include a buffer on both ends of the data range
const buffer = 0.1; // Adjust the buffer as needed
const visibleRange = dataRange * (1 + buffer);
chart.timeScale().setVisibleRange({
from: firstDataPoint - visibleRange,
to: lastDataPoint + visibleRange,
});
};
displayChart();
"
And the associated HTML file:
<title>Document</title> <script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script> <script src="OHLCV_CSV_STATIC.js"></script> ""
Thank you
The text was updated successfully, but these errors were encountered: