Skip to content

Commit

Permalink
[charts] Add z-axis to colorize scatter charts (mui#12738)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored and thomasmoon committed Sep 6, 2024
1 parent cd78289 commit 28653d8
Show file tree
Hide file tree
Showing 21 changed files with 651 additions and 142 deletions.
34 changes: 19 additions & 15 deletions docs/data/charts/bars/ColorScaleNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,55 +112,59 @@ export default function ColorScaleNoSnap() {
...(colorX === 'None' ? [' xAxis={[{}]}'] : []),
...(colorX === 'ordinal'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'ordinal',`,
` colors: ['#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'continuous'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: new Date(2019, 1, 1),`,
` max: new Date(2024, 1, 1),`,
` color: ['green', 'orange']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'piecewise'
? [
' xAxis={[{',
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` }`,
' }]}',
]
: []),
// ColorY
...(colorY === 'None' ? [' yAxis={[{}]}'] : []),
...(colorY === 'continuous'
? [
' yAxis={[',
` {`,
' yAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: -10,`,
` max: 10,`,
` color: ['red', 'green'],`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorY === 'piecewise'
? [
' yAxis={[{',
` type: 'piecewise',`,
` thresholds: [0],`,
` colors: ['red', 'green'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [0],`,
` colors: ['red', 'green'],`,
` }`,
' }]}',
]
: []),
Expand Down
36 changes: 19 additions & 17 deletions docs/data/charts/bars/ColorScaleNoSnap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,34 @@ export default function ColorScaleNoSnap() {
...(colorX === 'None' ? [' xAxis={[{}]}'] : []),
...(colorX === 'ordinal'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'ordinal',`,
` colors: ['#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'continuous'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: new Date(2019, 1, 1),`,
` max: new Date(2024, 1, 1),`,
` color: ['green', 'orange']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'piecewise'
? [
' xAxis={[{',
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` }`,
' }]}',
]
: []),
Expand All @@ -156,24 +158,24 @@ export default function ColorScaleNoSnap() {
...(colorY === 'None' ? [' yAxis={[{}]}'] : []),
...(colorY === 'continuous'
? [
' yAxis={[',
` {`,

' yAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: -10,`,
` max: 10,`,
` color: ['red', 'green'],`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorY === 'piecewise'
? [
' yAxis={[{',
` type: 'piecewise',`,
` thresholds: [0],`,
` colors: ['red', 'green'],`,

` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [0],`,
` colors: ['red', 'green'],`,
` }`,
' }]}',
]
: []),
Expand Down
28 changes: 16 additions & 12 deletions docs/data/charts/lines/ColorScaleNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,45 +103,49 @@ export default function ColorScaleNoSnap() {
...(colorX === 'None' ? [' xAxis={[{}]}'] : []),
...(colorX === 'continuous'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: new Date(2019, 1, 1),`,
` max: new Date(2024, 1, 1),`,
` color: ['green', 'orange']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'piecewise'
? [
' xAxis={[{',
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` }`,
' }]}',
]
: []),
// ColorY
...(colorY === 'None' ? [' yAxis={[{}]}'] : []),
...(colorY === 'continuous'
? [
' yAxis={[',
` {`,
' yAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: -10,`,
` max: 10,`,
` color: ['red', 'green'],`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorY === 'piecewise'
? [
' yAxis={[{',
` type: 'piecewise',`,
` thresholds: [0, 10],`,
` colors: ['red', 'green', 'blue'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [0, 10],`,
` colors: ['red', 'green', 'blue'],`,
` }`,
' }]}',
]
: []),
Expand Down
29 changes: 16 additions & 13 deletions docs/data/charts/lines/ColorScaleNoSnap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,24 @@ export default function ColorScaleNoSnap() {
...(colorX === 'None' ? [' xAxis={[{}]}'] : []),
...(colorX === 'continuous'
? [
' xAxis={[',
` {`,
' xAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: new Date(2019, 1, 1),`,
` max: new Date(2024, 1, 1),`,
` color: ['green', 'orange']`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorX === 'piecewise'
? [
' xAxis={[{',
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [new Date(2021, 1, 1), new Date(2023, 1, 1)],`,
` colors: ['blue', 'red', 'blue'],`,
` }`,
' }]}',
]
: []),
Expand All @@ -135,23 +137,24 @@ export default function ColorScaleNoSnap() {
...(colorY === 'None' ? [' yAxis={[{}]}'] : []),
...(colorY === 'continuous'
? [
' yAxis={[',
` {`,
' yAxis={[{',
` colorMap: {`,
` type: 'continuous',`,
` min: -10,`,
` max: 10,`,
` color: ['red', 'green'],`,
` }`,
' ]}',
' }]}',
]
: []),
...(colorY === 'piecewise'
? [
' yAxis={[{',
` type: 'piecewise',`,
` thresholds: [0, 10],`,
` colors: ['red', 'green', 'blue'],`,

` colorMap: {`,
` type: 'piecewise',`,
` thresholds: [0, 10],`,
` colors: ['red', 'green', 'blue'],`,
` }`,
' }]}',
]
: []),
Expand Down
Loading

0 comments on commit 28653d8

Please sign in to comment.