forked from chartjs/Chart.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scriptable options for polar area charts (chartjs#5976)
- Loading branch information
1 parent
4160ef4
commit 6163b08
Showing
53 changed files
with
1,092 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/fixtures/controller.polarArea/backgroundColor/indexable-dataset.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
config: { | ||
type: 'polarArea', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: [ | ||
'#ff0000', | ||
'#00ff00', | ||
'#0000ff', | ||
'#ffff00', | ||
'#ff00ff', | ||
'#000000' | ||
] | ||
}, | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
scale: { | ||
display: false | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+11.4 KB
test/fixtures/controller.polarArea/backgroundColor/indexable-dataset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
test/fixtures/controller.polarArea/backgroundColor/indexable-element-options.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
config: { | ||
type: 'polarArea', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: [ | ||
'#ff88ff', | ||
'#888888', | ||
'#ff8800', | ||
'#00ff88', | ||
'#8800ff', | ||
'#ffff88' | ||
] | ||
} | ||
}, | ||
scale: { | ||
display: false | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+11.2 KB
test/fixtures/controller.polarArea/backgroundColor/indexable-element-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
test/fixtures/controller.polarArea/backgroundColor/scriptable-dataset.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
config: { | ||
type: 'polarArea', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff0000' | ||
: value > 6 ? '#00ff00' | ||
: value > 2 ? '#0000ff' | ||
: '#ff00ff'; | ||
} | ||
}, | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
scale: { | ||
display: false | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+11.2 KB
test/fixtures/controller.polarArea/backgroundColor/scriptable-dataset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions
38
test/fixtures/controller.polarArea/backgroundColor/scriptable-element-options.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = { | ||
config: { | ||
type: 'polarArea', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff0000' | ||
: value > 6 ? '#00ff00' | ||
: value > 2 ? '#0000ff' | ||
: '#ff00ff'; | ||
} | ||
} | ||
}, | ||
scale: { | ||
display: false | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+11.2 KB
test/fixtures/controller.polarArea/backgroundColor/scriptable-element-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
test/fixtures/controller.polarArea/backgroundColor/value-dataset.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
config: { | ||
type: 'polarArea', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: '#ff0000' | ||
}, | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
scale: { | ||
display: false | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.