Skip to content

Commit

Permalink
Tooltips added now only if tooltips are not supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
benstoltz committed Feb 28, 2017
1 parent 2b678fe commit 50a104c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions site/source/partials/example-bar-url.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
}
];
//
// chart.tooltip = {
// "title": "{Type}",
// "content": "{Number_of_SUM} Students in {Type}"
// }
chart.tooltip = {
"title": "{Type}",
"content": "{Number_of_SUM} Students in {Type}"
}
//assign to the chart
chart.datasets = datasets;
Expand Down
12 changes: 7 additions & 5 deletions src/cedar.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,13 @@ export default class Cedar {
try {
if (this._definition.datasets && this._definition.series) {
this._definition.dataset = specUtils.convertDatasetsToDataset(this._definition.datasets, this._definition.series, this._chartType, this._definition.dataset);
this._definition.tooltip = {
'title': `{${this._definition.series[0].category.field}}`,
'content': `{${this._definition.series[0].value.field}}`,
'id': `cedar-${Date.now()}`
};
if (!this._definition.tooltip) {
this._definition.tooltip = {
'title': `{${this._definition.series[0].category.field}}`,
'content': `{${this._definition.series[0].value.field}}`,
'id': `cedar-${Date.now()}`
};
}
}

// Creates the HTML Div and styling if not already created
Expand Down

0 comments on commit 50a104c

Please sign in to comment.