Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while applying timeScale options after enabling left and right scales #443

Closed
timocov opened this issue May 19, 2020 · 0 comments · Fixed by #456
Closed

Error while applying timeScale options after enabling left and right scales #443

timocov opened this issue May 19, 2020 · 0 comments · Fixed by #456
Assignees
Labels
bug Unexpected problem or unintended behavior.
Milestone

Comments

@timocov
Copy link
Contributor

timocov commented May 19, 2020

Lightweight Charts Version: dev version

Steps/code to reproduce:

A test case for applying options:

function generateBar(i, target) {
	var step = (i % 20) / 1000;
	var base = i / 5;
	target.open = base * (1 - step);
	target.high = base * (1 + 2 * step);
	target.low = base * (1 - 2 * step);
	target.close = base * (1 + step);
}

function generateData() {
	var res = [];
	var time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0));
	for (var i = 0; i < 500; ++i) {
		var item = {
			time: time.getTime() / 1000,
		};
		time.setUTCDate(time.getUTCDate() + 1);

		generateBar(i, item);
		res.push(item);
	}
	return res;
}

// eslint-disable-next-line no-unused-vars
function runTestCase(container) {
	var chart = LightweightCharts.createChart(container);

	var mainSeries = chart.addCandlestickSeries();

	mainSeries.setData(generateData());

	chart.applyOptions({
		leftPriceScale: { visible: true },
		rightPriceScale: { visible: true },
		timeScale: {}, // this cause an error
	});
}

Actual behavior:

A ton of errors like the following:

lightweight-charts.standalone.development.js:136 Uncaught Error: Value is null
    at ensureNotNull (lightweight-charts.standalone.development.js:136)
    at ChartWidget._private__adjustSizeImpl (lightweight-charts.standalone.development.js:10164)
    at ChartWidget.adjustSize (lightweight-charts.standalone.development.js:10059)
    at Object.callback (lightweight-charts.standalone.development.js:9989)
    at lightweight-charts.standalone.development.js:1560
    at Array.forEach (<anonymous>)
    at Delegate.fire (lightweight-charts.standalone.development.js:1560)
    at TimeScale.applyOptions (lightweight-charts.standalone.development.js:5881)
    at ChartModel.applyOptions (lightweight-charts.standalone.development.js:7237)
    at ChartWidget.applyOptions (lightweight-charts.standalone.development.js:10063)

Expected behavior:

No errors, both left and right price scales are visible.

The issue caused by #290.

@timocov timocov added the bug Unexpected problem or unintended behavior. label May 19, 2020
@timocov timocov added this to the 3.0 milestone May 19, 2020
@timocov timocov self-assigned this May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior.
Projects
None yet
1 participant