-
Notifications
You must be signed in to change notification settings - Fork 12k
Make line properties scriptable #6128
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
Merged
simonbrunel
merged 29 commits into
chartjs:master
from
janelledement:make-all-line-properties-scriptable
Mar 21, 2019
Merged
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
6cb39a6
Initial line controller scriptable options.
janelledement 9736257
Adds backgroundColor tests.
janelledement fc9a2d7
Slight change to line-indexable backgroundColor.
janelledement d9732bc
Adds tests for borderColor
janelledement 47604a8
Adds tests for borderWidth.
janelledement 964edf6
Adds tests for boderCapStyle and a minor change to borderWidth test.
janelledement 5a1d7d8
Gets rid of indexable capability and tests
janelledement 3dd557b
Adds remaining tests (borderDash, etc)
janelledement cadedf0
Updates line doc
janelledement 5bbcb7a
Updates scriptable line sample
janelledement 99ef10e
Updates 'should ignore invalid values' (fill test)
janelledement 910e110
Gets rid of unnecessary LINE_OPTIONS var
janelledement d6ef1f0
Adds testing adjustment
janelledement 7bc4239
Updates test naming convention
janelledement c20f270
Addresses root cause of fail tests
janelledement 3281f89
Removes a comment
janelledement fd338d7
Improves clarity of borderCapStyle tests/pngs.
janelledement 219d84b
Makes minor changes to line controller
janelledement 5103d26
Makes minor changes to scriptable sample chart
janelledement 91e6228
Improves data for cubicInterpolationMode tests
janelledement 40c602a
Adds padding and eliminates use of reduce in tests
janelledement 6f9429e
Checks for ctx.dataIndex on appropriate tests
janelledement 76b9d09
Orders line options in tests alphabetically
janelledement 1eb2a2c
Fixes minor lint errors
janelledement bfcdd79
Gets rid of grey color fill in borderCapStyle test
janelledement d2f8173
Keeps borderColor fallback in elements.point
janelledement d9d1616
Adds fallback point borderColor/Width
janelledement 54a0296
Makes adjustments to borderColor scriptable test
janelledement 2a673d9
Improves clarity for borderWidth scriptable test
janelledement File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Binary file modified
BIN
+9.25 KB
(280%)
test/fixtures/controller.line/backgroundColor/scriptable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions
64
test/fixtures/controller.line/borderCapStyle/scriptable.js
This file contains hidden or 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,64 @@ | ||
module.exports = { | ||
config: { | ||
type: 'line', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [4, 5, 10, null, -10, -5], | ||
borderCapStyle: function(ctx) { | ||
var dataTotal = ctx.dataset.data.reduce(function(a, b) { | ||
return a + b; | ||
}); | ||
var style = dataTotal > 0 ? 'round' : 'square'; | ||
|
||
return style; | ||
simonbrunel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [-4, -5, -10, null, 10, 5], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
simonbrunel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
line: { | ||
borderColor: '#D60000', | ||
borderWidth: 10, | ||
borderCapStyle: function(ctx) { | ||
var dataTotal = ctx.dataset.data.reduce(function(a, b) { | ||
return a + b; | ||
}); | ||
var style = dataTotal > 0 ? 'round' : 'square'; | ||
|
||
return style; | ||
} | ||
}, | ||
point: { | ||
radius: 10, | ||
} | ||
}, | ||
scales: { | ||
xAxes: [{display: false}], | ||
yAxes: [ | ||
{ | ||
display: false, | ||
ticks: { | ||
beginAtZero: true | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
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.
This file contains hidden or 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,44 @@ | ||
module.exports = { | ||
config: { | ||
type: 'line', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 5, 10, null, -10, -5], | ||
borderCapStyle: 'round', | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [4, -5, -10, null, 10, 5], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
line: { | ||
borderColor: '#00ff00', | ||
borderCapStyle: 'butt', | ||
borderWidth: 10, | ||
fill: false, | ||
}, | ||
point: { | ||
radius: 10, | ||
} | ||
}, | ||
scales: { | ||
xAxes: [{display: false}], | ||
yAxes: [{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.
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.