mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
add right axis to hour graph
This commit is contained in:
parent
43d8e5c9f0
commit
6592fd0da9
1 changed files with 12 additions and 2 deletions
|
@ -11,7 +11,7 @@ import { interpolateBlues } from "d3-scale-chromatic";
|
||||||
import "d3-transition";
|
import "d3-transition";
|
||||||
import { select, mouse } from "d3-selection";
|
import { select, mouse } from "d3-selection";
|
||||||
import { scaleLinear, scaleBand, scaleSequential } from "d3-scale";
|
import { scaleLinear, scaleBand, scaleSequential } from "d3-scale";
|
||||||
import { axisBottom, axisLeft } from "d3-axis";
|
import { axisBottom, axisLeft, axisRight } from "d3-axis";
|
||||||
import { showTooltip, hideTooltip } from "./tooltip";
|
import { showTooltip, hideTooltip } from "./tooltip";
|
||||||
import {
|
import {
|
||||||
GraphBounds,
|
GraphBounds,
|
||||||
|
@ -97,7 +97,8 @@ export function renderHours(
|
||||||
|
|
||||||
const y = scaleLinear()
|
const y = scaleLinear()
|
||||||
.range([bounds.height - bounds.marginBottom, bounds.marginTop])
|
.range([bounds.height - bounds.marginBottom, bounds.marginTop])
|
||||||
.domain([0, yMax]);
|
.domain([0, yMax])
|
||||||
|
.nice();
|
||||||
svg.select<SVGGElement>(".y-ticks")
|
svg.select<SVGGElement>(".y-ticks")
|
||||||
.transition(trans)
|
.transition(trans)
|
||||||
.call(
|
.call(
|
||||||
|
@ -140,6 +141,15 @@ export function renderHours(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
svg.select<SVGGElement>(".y2-ticks")
|
||||||
|
.transition(trans)
|
||||||
|
.call(
|
||||||
|
axisRight(yArea)
|
||||||
|
.ticks(bounds.height / 50)
|
||||||
|
.tickFormat((n: any) => `${Math.round(n * 100)}%`)
|
||||||
|
.tickSizeOuter(0)
|
||||||
|
);
|
||||||
|
|
||||||
svg.select("path.area")
|
svg.select("path.area")
|
||||||
.datum(data)
|
.datum(data)
|
||||||
.attr(
|
.attr(
|
||||||
|
|
Loading…
Reference in a new issue