Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parsing support to pie/doughnut charts (#9622)
- Loading branch information
Showing
4 changed files
with
53 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
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||
import DatasetController from '../core/core.datasetController'; | ||||
import {isArray, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core'; | ||||
import {isArray, isObject, resolveObjectKey, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core'; | ||||
import {formatNumber} from '../helpers/helpers.intl'; | ||||
import {toRadians, PI, TAU, HALF_PI, _angleBetween} from '../helpers/helpers.math'; | ||||
|
||||
|
@@ -54,9 +54,21 @@ export default class DoughnutController extends DatasetController { | |||
parse(start, count) { | ||||
const data = this.getDataset().data; | ||||
const meta = this._cachedMeta; | ||||
let i, ilen; | ||||
for (i = start, ilen = start + count; i < ilen; ++i) { | ||||
meta._parsed[i] = +data[i]; | ||||
|
||||
if (this._parsing === false) { | ||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kurkle
Member
|
this._parsing = this.options.parsing; |
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,21 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: ['Red', 'Blue', 'Yellow'], | ||
datasets: [{ | ||
data: [ | ||
{foo: 12}, | ||
{foo: 4}, | ||
{foo: 6}, | ||
], | ||
backgroundColor: ['red', 'blue', 'yellow'] | ||
}] | ||
}, | ||
options: { | ||
parsing: { | ||
key: 'foo' | ||
} | ||
} | ||
} | ||
}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
I was looking at the Dougnut Controller and I cannot make sense of the private _parsing property which seems to never get written, can you explain how this is used?