Skip to content
Closed
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
14 changes: 14 additions & 0 deletions docs/general/data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ options: {
}
```

When using keys of the form `foo.bar`, you can allow for escaping dot symbol and add a double slash before the dot.

```javascript
type: 'doughnut',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to line or bar since the doughnut chart does not use xAxisKey and yAxisKey

data: {
datasets: [{
data: [{ "data.key": "one", "data.value": 20 }, { "data.key": "two", "data.value": 30 }],
}]
},
options: {
parsing: { xAxisKey: "data\\.key", yAxisKey: "data\\.value"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the xAxisKey and yAxisKey both on a separate line to match other code block

}
```

:::warning
When using object notation in a radar chart you still need a labels array with labels for the chart to show correctly.
:::
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/helpers.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ export function resolveObjectKey(obj, key) {
if (key === emptyString) {
return obj;
}
if (key.match(/[\\]/g)) {
return obj[key.replace(/[\\]/g, '')];
}
let pos = 0;
let idx = indexOfDotOrLength(key, pos);
while (obj && idx > pos) {
Expand Down