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

Add index for tooltip label #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/index.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/js/charts/AxisChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export default class AxisChart extends BaseChart {

this.dataByIndex[index] = {
label: label,
formattedLabel: formatX ? formatX(label) : label,
formattedLabel: formatX ? formatX(label, index) : label,
xPos: s.xAxis.positions[index],
values: values,
yExtreme: s.yExtremes[index],
Expand Down
12 changes: 6 additions & 6 deletions src/js/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,24 @@ export function round(d) {
* Creates a deep clone of an object
* @param {Object} candidate Any Object
*/
export function deepClone(candidate) {
export function deepClone(candidate) {
let cloned, value, key;

if (candidate instanceof Date) {
return new Date(candidate.getTime());
return new Date(candidate.getTime());
}

if (typeof candidate !== "object" || candidate === null) {
return candidate;
return candidate;
}

cloned = Array.isArray(candidate) ? [] : {};

for (key in candidate) {
value = candidate[key];
value = candidate[key];

cloned[key] = deepClone(value);
cloned[key] = deepClone(value);
}

return cloned;
}
}