Skip to content
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

Draw the rightmost grid line when offsetGridLines is true #6326

Merged
merged 5 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
329 changes: 192 additions & 137 deletions src/core/core.scale.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var defaultConfig = {

angleLines: {
display: true,
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
lineWidth: 1,
borderDash: [],
borderDashOffset: 0.0
Expand Down
12 changes: 6 additions & 6 deletions test/specs/core.scale.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ describe('Core.scale', function() {
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5'],
offsetGridLines: true,
offset: false,
expected: [-63.5, 64.5, 192.5, 320.5, 448.5]
expected: [64.5, 192.5, 320.5, 448.5]
}, {
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5'],
offsetGridLines: true,
offset: true,
expected: [0.5, 102.5, 204.5, 307.5, 409.5]
expected: [0.5, 102.5, 204.5, 307.5, 409.5, 512.5]
}, {
labels: ['tick1'],
offsetGridLines: false,
Expand All @@ -109,16 +109,16 @@ describe('Core.scale', function() {
labels: ['tick1'],
offsetGridLines: true,
offset: false,
expected: [-511.5]
expected: [512.5]
}, {
labels: ['tick1'],
offsetGridLines: true,
offset: true,
expected: [0.5]
expected: [0.5, 512.5]
}];

gridLineTests.forEach(function(test) {
it('should get the correct pixels for ' + test.labels.length + ' gridLine(s) for the horizontal scale when offsetGridLines is ' + test.offsetGridLines + ' and offset is ' + test.offset, function() {
it('should get the correct pixels for gridLine(s) for the horizontal scale when offsetGridLines is ' + test.offsetGridLines + ' and offset is ' + test.offset, function() {
var chart = window.acquireChart({
type: 'line',
data: {
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('Core.scale', function() {
});

gridLineTests.forEach(function(test) {
it('should get the correct pixels for ' + test.labels.length + ' gridLine(s) for the vertical scale when offsetGridLines is ' + test.offsetGridLines + ' and offset is ' + test.offset, function() {
it('should get the correct pixels for gridLine(s) for the vertical scale when offsetGridLines is ' + test.offsetGridLines + ' and offset is ' + test.offset, function() {
var chart = window.acquireChart({
type: 'line',
data: {
Expand Down
2 changes: 1 addition & 1 deletion test/specs/scale.category.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Category scale tests', function() {
display: true,

gridLines: {
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true, // draw ticks extending towards the label
Expand Down
2 changes: 1 addition & 1 deletion test/specs/scale.linear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Linear Scale', function() {
display: true,

gridLines: {
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true, // draw ticks extending towards the label
Expand Down
2 changes: 1 addition & 1 deletion test/specs/scale.logarithmic.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Logarithmic Scale tests', function() {
expect(defaultConfig).toEqual({
display: true,
gridLines: {
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true,
Expand Down
4 changes: 2 additions & 2 deletions test/specs/scale.radialLinear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Test the radial linear scale', function() {
expect(defaultConfig).toEqual({
angleLines: {
display: true,
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
lineWidth: 1,
borderDash: [],
borderDashOffset: 0.0
Expand All @@ -22,7 +22,7 @@ describe('Test the radial linear scale', function() {
display: true,
gridLines: {
circular: false,
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true,
Expand Down
2 changes: 1 addition & 1 deletion test/specs/scale.time.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Time scale tests', function() {
expect(defaultConfig).toEqual({
display: true,
gridLines: {
color: 'rgba(0, 0, 0, 0.1)',
color: 'rgba(0,0,0,0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true,
Expand Down