Skip to content
Snippets Groups Projects
Commit 199589da authored by Tom Robinson's avatar Tom Robinson
Browse files

Remove old tooltip code

parent 26c7f49f
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ import {
} from "./utils";
import { computeTimeseriesTicksInterval } from "./timeseries";
import { determineSeriesIndexFromElement, getPieSliceTextElement } from "./tooltip";
import { determineSeriesIndexFromElement } from "./tooltip";
import { formatValue } from "metabase/lib/formatting";
......
import d3 from "d3";
function getElementIndex(e) {
return [...e.classList].map(c => c.match(/^_(\d+)$/)).filter(c => c).map(c => parseInt(c[1], 10))[0];
}
export function getPieSliceTextElement(element) {
let index = getElementIndex(element);
return element.parentNode.querySelector("text.pie-slice._"+index);
}
// HACK: This determines the index of the series the provided element belongs to since DC doesn't seem to provide another way
export function determineSeriesIndexFromElement(element) {
// composed charts:
......@@ -31,21 +23,3 @@ export function determineSeriesIndexFromElement(element) {
// none?
return null;
}
export function getPieSliceCentroid(element, slice) {
let parent = element.parentNode.parentNode;
let radius = parent.getBoundingClientRect().height / 2;
let innerRadius = 0;
let centroid = d3.svg.arc()
.outerRadius(radius).innerRadius(innerRadius)
.padAngle(slice.padAngle).startAngle(slice.startAngle).endAngle(slice.endAngle)
.centroid();
let pieRect = parent.getBoundingClientRect();
return {
x: pieRect.left + radius + centroid[0],
y: pieRect.top + radius + centroid[1]
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment