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

idxs is empty #959

Open
Scheuraa007 opened this issue Jun 14, 2024 · 1 comment
Open

idxs is empty #959

Scheuraa007 opened this issue Jun 14, 2024 · 1 comment

Comments

@Scheuraa007
Copy link

Hello together,
i have the following chart options.

{
		title: "Graph",
		width: 200,
		height: 110,
		cursor: {
			drag: {
				setScale:false,
				x: false,
				y: true,
			},
		},
		select: {
			show: false,
			height: 0,
			left: 0,
			top: 0,
			width: 0,
		},
		plugins: [touchZoomPlugin(), tooltipsPlugin(), clickPlugin(), mousePanPlugin()],
		scales: {
			x: {
				time: false,
			},
			y: {
                         auto: false, 
				min: yMin, // initial value
                                max: alertValue, // initial value
				range: () => {
					return [ yMin,alertValue];
				},
			},
		},
		series: [
			{},
			{
				show: true,
				label: "ppm",
				stroke: "#007ab3",
				width: 2,
				points: {
					show: false,
				},
			},
			{
				show: false,
				label: "speed",
				stroke: "orange",
				width: 2,
			},
			{
				show: false,
				label: "time",
				stroke: "green",
				width: 2,
			},
			{
				show: true,
				stroke: "#000000",
				width: 2,
				points: {
					show: false,
				},
			},
			{
				show: true,
				stroke: "#15ff00",
				width: 2,
				points: {
					show: false,
				},
			},
		],
		axes: [
			{
				grid: {
					show: false,
				},
				show: false,
			},
			{
				grid: { show: false },
			},
		],
		legend: {
			show: false,
		},
		hooks: {
			drawSeries: [
				function alertSeries(u, si) {
					drawLine(u, si, alertValue, "red");
				},
			],
		},
	}

And i set the data to this chart with the following method:

const receivedData = this.data as RouteData;
this.activeRouteCoordinates[this.activeRouteCounter] = receivedData.coordinates[0];
this.activeDataPoints = [
	[...this.activeDataPoints[0], this.activeRouteCounter],
	[...this.activeDataPoints[1], receivedData.mainMeasurement[0]],
	[...this.activeDataPoints[2], receivedData.speed[0]],
	[...this.activeDataPoints[3], receivedData.time[0]],
	[...this.activeDataPoints[4], receivedData.secondMeasurement[0]],
	[...this.activeDataPoints[5], receivedData.thirdMeasurement[0]],
];
this.activeRouteCounter++;

const dataLength = this.activeDataPoints[0].length;
if (dataLength > 200) {
	this.chart.setSize({
		width: dataLength,
		height: getHeightForGraph(),
	});

	const newScrollWidth = getBrowserWidth();
	if (this.chartWidth < newScrollWidth && !this.autoscroll) {
		window.scrollBy({ top: 0, left: 5, behavior: "smooth" });
		this.chartWidth = newScrollWidth; // aktualisiere scrollWidth
	}
} else {
	this.chart.setSize({
		width: 200,
		height: getHeightForGraph(),
	});
}

if(IsZoomed === false)
{
		this.chart.setData(this.activeDataPoints);
		window.smtGraph.coords = this.activeRouteCoordinates;
}
	else
{
	this.chart.scales.y.range = () => [ Y_range[0],Y_range[1]];
	setYrange(false,Y_range[0],Y_range[1]);
}

This method is called about 3 times a second.
When i check this.chart.data after the method all data is in it.
But when i check the series the idxs of them are all an empty array.
Can anybody help me why i have this problem?

@Scheuraa007
Copy link
Author

Seems like it is an 1.6.30 Bug. On Version 1.6.20 the same code worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant