Skip to content

Commit

Permalink
Revert breaking API naming changes on tick property (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon authored Sep 18, 2020
1 parent 4f9eba4 commit 02af818
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion __tests__/unit/attributes/baseAxis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BaseAxis from 'c/baseAxis';
const TEST_DATA_PROPERTIES = [
ChartOptionMock('display', true, { display: true }),
ChartOptionMock('weight', 'foo', { weight: 'foo' }),
ChartOptionMock('tickCallback', 'foo', {
ChartOptionMock('ticksCallback', 'foo', {
ticks: { callback: 'foo' }
}),
ChartOptionMock('callbackBeforeupdate', 'foo', {
Expand Down
20 changes: 10 additions & 10 deletions __tests__/unit/attributes/cartesianAxis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ const TEST_DATA_PROPERTIES = [
}),
ChartOptionMock('offset', 'foo', { yAxes: [{ offset: 'foo' }] }),
ChartOptionMock('id', 'foo', { yAxes: [{ id: 'foo' }] }),
ChartOptionMock('tickMin', 'foo', {
ChartOptionMock('ticksMin', 'foo', {
yAxes: [{ ticks: { min: 'foo' } }]
}),
ChartOptionMock('tickMax', 'foo', {
ChartOptionMock('ticksMax', 'foo', {
yAxes: [{ ticks: { max: 'foo' } }]
}),
ChartOptionMock('tickSamplesize', 1, {
ChartOptionMock('ticksSamplesize', 1, {
yAxes: [{ ticks: { sampleSize: 1 } }]
}),
ChartOptionMock('tickAutoskip', 'foo', {
ChartOptionMock('ticksAutoskip', 'foo', {
yAxes: [{ ticks: { autoSkip: 'foo' } }]
}),
ChartOptionMock('tickAutoskippadding', 1, {
ChartOptionMock('ticksAutoskippadding', 1, {
yAxes: [{ ticks: { autoSkipPadding: 1 } }]
}),
ChartOptionMock('tickLabeloffset', 1, {
ChartOptionMock('ticksLabeloffset', 1, {
yAxes: [{ ticks: { labelOffset: 1 } }]
}),
ChartOptionMock('tickMaxrotation', 1, {
ChartOptionMock('ticksMaxrotation', 1, {
yAxes: [{ ticks: { maxRotation: 1 } }]
}),
ChartOptionMock('tickMinrotation', 1, {
ChartOptionMock('ticksMinrotation', 1, {
yAxes: [{ ticks: { minRotation: 1 } }]
}),
ChartOptionMock('tickMirror', 'foo', {
ChartOptionMock('ticksMirror', 'foo', {
yAxes: [{ ticks: { mirror: 'foo' } }]
}),
ChartOptionMock('tickPadding', 1, {
ChartOptionMock('ticksPadding', 1, {
yAxes: [{ ticks: { padding: 1 } }]
}),
ChartOptionMock('titleDisplay', 'foo', {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/attributes/cartesianCategoryAxis.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CartesianCategoryAxis from 'c/cartesianCategoryAxis';

const TEST_DATA_PROPERTIES = [
ChartOptionMock('tickLabels', 'foo', {
ChartOptionMock('ticksLabels', 'foo', {
yAxes: [{ ticks: { labels: 'foo' } }]
})
];
Expand Down
12 changes: 6 additions & 6 deletions __tests__/unit/attributes/cartesianLinearAxis.test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import CartesianLinearAxis from 'c/cartesianLinearAxis';

const TEST_DATA_PROPERTIES = [
ChartOptionMock('tickBeginatzero', true, {
ChartOptionMock('ticksBeginatzero', true, {
yAxes: [{ ticks: { beginAtZero: true } }]
}),
ChartOptionMock('tickMaxtickslimit', 1, {
ChartOptionMock('ticksMaxtickslimit', 1, {
yAxes: [{ ticks: { maxTicksLimit: 1 } }]
}),
ChartOptionMock('tickPrecision', 'foo', {
ChartOptionMock('ticksPrecision', 'foo', {
yAxes: [{ ticks: { precision: 'foo' } }]
}),
ChartOptionMock('tickStepsize', 1, {
ChartOptionMock('ticksStepsize', 1, {
yAxes: [{ ticks: { stepSize: 1 } }]
}),
ChartOptionMock('tickSuggestedmax', '1', {
ChartOptionMock('ticksSuggestedmax', '1', {
yAxes: [{ ticks: { suggestedMax: '1' } }]
}),
ChartOptionMock('tickSuggestedmin', '1', {
ChartOptionMock('ticksSuggestedmin', '1', {
yAxes: [{ ticks: { suggestedMin: '1' } }]
})
];
Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/lwc/baseAxis/baseAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default class BaseAxis extends BaseAttribute {
}

@api
get tickCallback() {
get ticksCallback() {
this._content.ticks = this._content.ticks || {};
return this._content.ticks.callback;
}
set tickCallback(v) {
set ticksCallback(v) {
this._content.ticks = this._content.ticks || {};
this._content.ticks.callback = v;
}
Expand Down
40 changes: 20 additions & 20 deletions force-app/main/default/lwc/cartesianAxis/cartesianAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,82 +62,82 @@ export default class CartesianAxis extends BaseAxis {

// Ticks Configuration: https://www.chartjs.org/docs/latest/axes/cartesian/#tick-configuration
@api
get tickMin() {
get ticksMin() {
return this._content.ticks.min;
}
set tickMin(v) {
set ticksMin(v) {
this._content.ticks.min = Number(v) || v;
}

@api
get tickMax() {
get ticksMax() {
return this._content.ticks.max;
}
set tickMax(v) {
set ticksMax(v) {
this._content.ticks.max = Number(v) || v;
}

@api
get tickSamplesize() {
get ticksSamplesize() {
return this._content.ticks.sampleSize;
}
set tickSamplesize(v) {
set ticksSamplesize(v) {
this._content.ticks.sampleSize = Number(v);
}

@api
get tickAutoskip() {
get ticksAutoskip() {
return this._content.ticks.autoSkip;
}
set tickAutoskip(v) {
set ticksAutoskip(v) {
this._content.ticks.autoSkip = v;
}

@api
get tickAutoskippadding() {
get ticksAutoskippadding() {
return this._content.ticks.autoSkipPadding;
}
set tickAutoskippadding(v) {
set ticksAutoskippadding(v) {
this._content.ticks.autoSkipPadding = Number(v);
}

@api
get tickLabeloffset() {
get ticksLabeloffset() {
return this._content.ticks.labelOffset;
}
set tickLabeloffset(v) {
set ticksLabeloffset(v) {
this._content.ticks.labelOffset = Number(v);
}

@api
get tickMaxrotation() {
get ticksMaxrotation() {
return this._content.ticks.maxRotation;
}
set tickMaxrotation(v) {
set ticksMaxrotation(v) {
this._content.ticks.maxRotation = Number(v);
}

@api
get tickMinrotation() {
get ticksMinrotation() {
return this._content.ticks.minRotation;
}
set tickMinrotation(v) {
set ticksMinrotation(v) {
this._content.ticks.minRotation = Number(v);
}

@api
get tickMirror() {
get ticksMirror() {
return this._content.ticks.mirror;
}
set tickMirror(v) {
set ticksMirror(v) {
this._content.ticks.mirror = v;
}

@api
get tickPadding() {
get ticksPadding() {
return this._content.ticks.padding;
}
set tickPadding(v) {
set ticksPadding(v) {
this._content.ticks.padding = Number(v);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { CARTESIAN_AXIS_TYPE_CATEGORY } from 'c/constants';
*/
export default class CartesianCategoryAxis extends CartesianAxis {
@api
get tickLabels() {
get ticksLabels() {
return this._content.ticks.labels;
}
set tickLabels(v) {
set ticksLabels(v) {
this._content.ticks.labels = v;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,50 @@ import { CARTESIAN_AXIS_TYPE_LINEAR } from 'c/constants';
*/
export default class CartesianLinearAxis extends CartesianAxis {
@api
get tickBeginatzero() {
get ticksBeginatzero() {
return this._content.ticks.beginAtZero;
}
set tickBeginatzero(v) {
set ticksBeginatzero(v) {
this._content.ticks.beginAtZero = Boolean(v);
}

@api
get tickMaxtickslimit() {
get ticksMaxtickslimit() {
return this._content.ticks.maxTicksLimit;
}
set tickMaxtickslimit(v) {
set ticksMaxtickslimit(v) {
this._content.ticks.maxTicksLimit = Number(v);
}

@api
get tickPrecision() {
get ticksPrecision() {
return this._content.ticks.precision;
}
set tickPrecision(v) {
set ticksPrecision(v) {
this._content.ticks.precision = v;
}

@api
get tickStepsize() {
get ticksStepsize() {
return this._content.ticks.stepSize;
}
set tickStepsize(v) {
set ticksStepsize(v) {
this._content.ticks.stepSize = Number(v);
}

@api
get tickSuggestedmax() {
get ticksSuggestedmax() {
return this._content.ticks.suggestedMax;
}
set tickSuggestedmax(v) {
set ticksSuggestedmax(v) {
this._content.ticks.suggestedMax = v;
}

@api
get tickSuggestedmin() {
get ticksSuggestedmin() {
return this._content.ticks.suggestedMin;
}
set tickSuggestedmin(v) {
set ticksSuggestedmin(v) {
this._content.ticks.suggestedMin = v;
}

Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/lwc/chartBuilder/chartBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
<template if:false={isRadial}>
<c-cartesian-linear-axis
axis="y"
tick-beginatzero="true"
ticks-beginatzero="true"
></c-cartesian-linear-axis>
</template>
<template if:true={isRadial}>
<c-radial-linear-axis
tick-beginatzero="true"
ticks-beginatzero="true"
></c-radial-linear-axis>
</template>
</c-chart>
Expand Down
16 changes: 8 additions & 8 deletions force-app/sample/default/lwc/sampleApp/sampleApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
<c-cartesian-linear-axis
axis="y"
position="right"
tick-min="-10"
ticks-min="-10"
title-display="true"
title-labelstring="yAxis items"
grid-zerolinecolor="rgba(225, 96, 50, 1"
Expand Down Expand Up @@ -212,7 +212,7 @@
&emsp;&lt;c-cartesian-axis axis=&quot;x&quot; position=&quot;top&quot;
type=&quot;category&quot;&gt;&lt;/c-cartesian-axis&gt;<br />
&emsp;&lt;c-cartesian-linear-axis axis=&quot;y&quot;
position=&quot;right&quot; tick-min=&quot;-10&quot;
position=&quot;right&quot; ticks-min=&quot;-10&quot;
title-display=&quot;true&quot;<br />
&emsp;&emsp;title-labelstring=&quot;yAxis items&quot;
grid-zerolinecolor=&quot;rgba(225, 96, 50, 1&quot;
Expand Down Expand Up @@ -550,7 +550,7 @@
</c-cartesian-category-axis>
<c-cartesian-linear-axis
axis="y"
tick-stepsize="15"
ticks-stepsize="15"
position="right"
title-display="true"
title-labelstring="Linear axis"
Expand All @@ -574,7 +574,7 @@
title-labelstring=&quot;Category axis&quot;&gt;<br />
&emsp;&lt;/c-cartesian-category-axis&gt;<br />
&emsp;&lt;c-cartesian-linear-axis axis=&quot;y&quot;
tick-stepsize=&quot;15&quot; position=&quot;right&quot;
ticks-stepsize=&quot;15&quot; position=&quot;right&quot;
title-display=&quot;true&quot; title-labelstring=&quot;Linear
axis&quot;&gt;&lt;/c-cartesian-linear-axis&gt;<br />
&lt;/c-chart&gt;
Expand Down Expand Up @@ -656,7 +656,7 @@
></c-cartesian-category-axis>
<c-cartesian-linear-axis
axis="x"
tick-beginatzero="true"
ticks-beginatzero="true"
></c-cartesian-linear-axis>
</c-chart>
<code slot="chartCode" lang="html">
Expand All @@ -676,7 +676,7 @@
&emsp;&lt;c-cartesian-category-axis axis=&quot;y&quot;
position=&quot;left&quot;&gt;&lt;/c-cartesian-category-axis&gt;<br />
&emsp;&lt;c-cartesian-linear-axis axis=&quot;x&quot;
tick-beginatzero=&quot;true&quot;&gt;&lt;/c-cartesian-linear-axis&gt;<br />
ticks-beginatzero=&quot;true&quot;&gt;&lt;/c-cartesian-linear-axis&gt;<br />
&lt;/c-chart&gt;
</code>
</c-sample-app-item>
Expand All @@ -699,7 +699,7 @@
axis="y"
position="left"
display="true"
tick-beginatzero="true"
ticks-beginatzero="true"
></c-cartesian-linear-axis>
<c-cartesian-time-axis
axis="x"
Expand All @@ -723,7 +723,7 @@
Chart&quot;&gt;&lt;/c-title&gt;<br />
&emsp;&lt;c-cartesian-linear-axis axis=&quot;y&quot;
position=&quot;left&quot; display=&quot;true&quot;
tick-beginatzero=&quot;true&quot;&gt;&lt;/c-cartesian-linear-axis&gt;<br />
ticks-beginatzero=&quot;true&quot;&gt;&lt;/c-cartesian-linear-axis&gt;<br />
&emsp;&lt;c-cartesian-time-axis axis=&quot;x&quot;
time-unit=&quot;day&quot; display=&quot;true&quot;
tick-source=&quot;data&quot; bounds=&quot;ticks&quot;&gt;<br />
Expand Down

0 comments on commit 02af818

Please sign in to comment.