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

Apply scale context to ticks scriptable options instead of chart context #8839

Merged
merged 5 commits into from Apr 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/axes/cartesian/linear.md
Expand Up @@ -23,13 +23,13 @@ Namespace: `options.scales[scaleId]`

Namespace: `options.scales[scaleId].ticks`

| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `count` | `number` | `undefined` | The number of ticks to generate. If specified, this overrides the automatic generation.
| `format` | `object` | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter
| `maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show.
| `precision` | `number` | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `number` | | User-defined fixed step size for the scale. [more...](#step-size)
| Name | Type | Scriptable | Default | Description
| ---- | ---- | ------- | ------- | -----------
| `count` | `number` | Yes | `undefined` | The number of ticks to generate. If specified, this overrides the automatic generation.
| `format` | `object` | Yes | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter
| `maxTicksLimit` | `number` | Yes | `11` | Maximum number of ticks and gridlines to show.
| `precision` | `number` | Yes | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
| `stepSize` | `number` | Yes | | User-defined fixed step size for the scale. [more...](#step-size)

!!!include(axes/cartesian/_common_ticks.md)!!!

Expand Down
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Expand Up @@ -237,7 +237,7 @@ export default class Scale extends Element {
*/
init(options) {
const me = this;
me.options = options;
me.options = options.setContext(me.getContext());

me.axis = options.axis;

Expand Down
4 changes: 2 additions & 2 deletions test/specs/core.controller.tests.js
Expand Up @@ -413,7 +413,7 @@ describe('Chart', function() {
});

expect(chart.scales.x.type).toBe('logarithmic');
expect(chart.scales.x.options).toBe(chart.options.scales.x);
expect(chart.scales.x.options).toEqual(chart.options.scales.x);
expect(chart.scales.x.options).toEqual(
jasmine.objectContaining({
_jasmineCheckA: 'a0',
Expand All @@ -423,7 +423,7 @@ describe('Chart', function() {
}));

expect(chart.scales.y.type).toBe('time');
expect(chart.scales.y.options).toBe(chart.options.scales.y);
expect(chart.scales.y.options).toEqual(chart.options.scales.y);
expect(chart.scales.y.options).toEqual(
jasmine.objectContaining({
_jasmineCheckA: 'a0',
Expand Down