-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the `clip` option (boolean, scriptable and indexable) which masks the part of the label which is outside the chart area (default `false`, no clipping).
- Loading branch information
1 parent
542ec92
commit 499dbb7
Showing
14 changed files
with
239 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var data = [ | ||
{x: 0, y: 0}, | ||
{x: 0, y: 1}, | ||
{x: 0, y: 2}, | ||
{x: 1, y: 0}, | ||
{x: 1, y: 1}, | ||
{x: 1, y: 2}, | ||
{x: 2, y: 0}, | ||
{x: 2, y: 1}, | ||
{x: 2, y: 2} | ||
]; | ||
|
||
export default { | ||
config: { | ||
type: 'bubble', | ||
data: { | ||
datasets: [{ | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#ff0077', | ||
borderColor: 'white', | ||
padding: 32, | ||
clip: [ | ||
false, | ||
true, | ||
false, | ||
true, | ||
false, | ||
true, | ||
false, | ||
true, | ||
false | ||
] | ||
} | ||
}, { | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#00ff77', | ||
borderColor: 'black', | ||
padding: 16, | ||
clip: [ | ||
true, | ||
false, | ||
true, | ||
false, | ||
true, | ||
false, | ||
true, | ||
false, | ||
true, | ||
] | ||
} | ||
}] | ||
}, | ||
options: { | ||
layout: { | ||
padding: 48 | ||
}, | ||
plugins: { | ||
datalabels: { | ||
borderWidth: 4, | ||
font: { | ||
size: 0 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 256 | ||
} | ||
} | ||
}; |
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 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,56 @@ | ||
var data = [ | ||
{x: 0, y: 0}, | ||
{x: 0, y: 1}, | ||
{x: 0, y: 2}, | ||
{x: 1, y: 0}, | ||
{x: 1, y: 1}, | ||
{x: 1, y: 2}, | ||
{x: 2, y: 0}, | ||
{x: 2, y: 1}, | ||
{x: 2, y: 2} | ||
]; | ||
|
||
export default { | ||
config: { | ||
type: 'bubble', | ||
data: { | ||
datasets: [{ | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#ff0077', | ||
borderColor: 'white', | ||
padding: 32 | ||
} | ||
}, { | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#00ff77', | ||
borderColor: 'black', | ||
padding: 16 | ||
} | ||
}] | ||
}, | ||
options: { | ||
layout: { | ||
padding: 48 | ||
}, | ||
plugins: { | ||
datalabels: { | ||
borderWidth: 4, | ||
clip: function(ctx) { | ||
return (ctx.dataIndex + ctx.datasetIndex) % 2 === 0; | ||
}, | ||
font: { | ||
size: 0 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 256 | ||
} | ||
} | ||
}; |
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 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,55 @@ | ||
var data = [ | ||
{x: 0, y: 0}, | ||
{x: 0, y: 1}, | ||
{x: 0, y: 2}, | ||
{x: 1, y: 0}, | ||
{x: 1, y: 1}, | ||
{x: 1, y: 2}, | ||
{x: 2, y: 0}, | ||
{x: 2, y: 1}, | ||
{x: 2, y: 2} | ||
]; | ||
|
||
export default { | ||
config: { | ||
type: 'bubble', | ||
data: { | ||
datasets: [{ | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#ff0077', | ||
borderColor: 'white', | ||
clip: true, | ||
padding: 32 | ||
} | ||
}, { | ||
data: data, | ||
datalabels: { | ||
backgroundColor: '#00ff77', | ||
borderColor: 'black', | ||
clip: false, | ||
padding: 16 | ||
} | ||
}] | ||
}, | ||
options: { | ||
layout: { | ||
padding: 48 | ||
}, | ||
plugins: { | ||
datalabels: { | ||
borderWidth: 4, | ||
font: { | ||
size: 0 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 256 | ||
} | ||
} | ||
}; |
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 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,20 @@ | ||
export default { | ||
'jasmine-chart-area': { | ||
afterDraw: function(chart) { | ||
var ctx = chart.ctx; | ||
var area = chart.chartArea; | ||
|
||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.rect( | ||
area.left, | ||
area.top, | ||
area.right - area.left, | ||
area.bottom - area.top); | ||
ctx.strokeStyle = 'blue'; | ||
ctx.lineWidth = 2; | ||
ctx.stroke(); | ||
ctx.restore(); | ||
} | ||
} | ||
}; |
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