Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(types): add [number, number] tuple support for line and scatter chart defaultDataPoint#12250

Open
subodhbhyri wants to merge 1 commit into
chartjs:masterchartjs/Chart.js:masterfrom
subodhbhyri:fix/tuple-data-types-12232subodhbhyri/Chart.js:fix/tuple-data-types-12232Copy head branch name to clipboard
Open

fix(types): add [number, number] tuple support for line and scatter chart defaultDataPoint#12250
subodhbhyri wants to merge 1 commit into
chartjs:masterchartjs/Chart.js:masterfrom
subodhbhyri:fix/tuple-data-types-12232subodhbhyri/Chart.js:fix/tuple-data-types-12232Copy head branch name to clipboard

Conversation

@subodhbhyri

Copy link
Copy Markdown

Problem

When using an array of tuples ([number, number][]) as dataset data on a line
or scatter chart, TypeScript raises:

Type '[number, number]' is not assignable to type 'ScatterDataPoint | number | null'

This is despite tuples being a documented data structure
and already being supported for bar charts via [number, number] in its defaultDataPoint.

Fixes #12232

Changes

  • Added [number, number] to defaultDataPoint for line and scatter in src/types/index.d.ts, matching the existing bar chart behavior
  • Added type test cases in test/types/dataset_null_data.ts and test/types/data_types.ts to cover both ChartDataset and full new Chart(...) instantiation with tuple data

Scope

This PR fixes the TypeScript type error only. The runtime issue (line not
rendering when parsing: false is set with tuple data) is a separate problem
in the data parsing pipeline and is not addressed here.

KrrishSR4

This comment was marked as resolved.

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

Successfully merging this pull request may close these issues.

Array of tuples data structure not working when parsing is disabled

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.