D3 imports (note the currentEvent hack needed; babel known issue with binding)

This commit is contained in:
Dannon Baker
2017-11-09 08:42:29 -05:00
parent 92519e5a56
commit dd1f69ad5c
4 changed files with 12 additions and 13 deletions
@@ -1,5 +1,5 @@
// TODO: get rid of this.
var d3 = window.d3;
import * as d3 from "../libs/d3";
import { event as currentEvent } from "../libs/d3";
function date_by_subtracting_days(date, days) {
return new Date(
@@ -127,7 +127,7 @@ export function create_chart(inp_data, name, time, title) {
var wdth = i * 4 + 10;
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("text")
.attr("transform", `translate( ${margin.left - 5}, ${height - d * zoom + +margin.top + 10} )`)
@@ -135,7 +135,7 @@ export function create_chart(inp_data, name, time, title) {
.text(d);
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.attr("width", `${wdth}px`)
.attr("height", "15px")
@@ -148,13 +148,13 @@ export function create_chart(inp_data, name, time, title) {
.on("mouseleave", d => {
// Remove tool tip
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("text")
.attr("visibility", "hidden");
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("rect")
.attr("width", "0")
@@ -569,7 +569,7 @@ export function create_histogram(inp_data, name, title) {
}
var wdth = i * 4 + 10;
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("text")
.attr("transform", `translate( ${margin.left - 5}, ${height - d.length * zoom + +margin.top + 10} )`)
@@ -577,7 +577,7 @@ export function create_histogram(inp_data, name, title) {
.text(d.length);
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.attr("width", `${wdth}px`)
.attr("height", "15px")
@@ -590,13 +590,13 @@ export function create_histogram(inp_data, name, title) {
.on("mouseleave", d => {
// Remove tool tip
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("text")
.attr("visibility", "hidden");
d3
.select(d3.event.path[1])
.select(currentEvent.path[1])
.select(".tool_tip")
.select("rect")
.attr("width", "0")
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -2,7 +2,6 @@
<%namespace file="/message.mako" import="render_msg" />
<%def name="javascripts()">
${h.js("libs/d3")}
${parent.javascripts()}
<script type="text/javascript">