mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 20:13:54 -05:00
cheesecake method
This commit is contained in:
parent
3d0a408a2b
commit
c2fdf474dd
2 changed files with 6 additions and 3 deletions
|
|
@ -292,7 +292,8 @@ impl Collection {
|
||||||
Ok((
|
Ok((
|
||||||
dr,
|
dr,
|
||||||
(
|
(
|
||||||
*result.memorized_cnt_per_day.last().unwrap_or(&0.),
|
*result.memorized_cnt_per_day.last().unwrap_or(&0.)
|
||||||
|
- *result.memorized_cnt_per_day.first().unwrap_or(&0.),
|
||||||
result.cost_per_day.iter().sum::<f32>(),
|
result.cost_per_day.iter().sum::<f32>(),
|
||||||
result.review_cnt_per_day.iter().sum::<usize>() as u32
|
result.review_cnt_per_day.iter().sum::<usize>() as u32
|
||||||
+ result.learn_cnt_per_day.iter().sum::<usize>() as u32,
|
+ result.learn_cnt_per_day.iter().sum::<usize>() as u32,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import {
|
||||||
bisector,
|
bisector,
|
||||||
line,
|
line,
|
||||||
max,
|
max,
|
||||||
|
min,
|
||||||
pointer,
|
pointer,
|
||||||
rollup,
|
rollup,
|
||||||
scaleLinear,
|
scaleLinear,
|
||||||
|
|
@ -62,7 +63,7 @@ export function renderWorkloadChart(
|
||||||
.range([bounds.marginLeft, bounds.width - bounds.marginRight]);
|
.range([bounds.marginLeft, bounds.width - bounds.marginRight]);
|
||||||
|
|
||||||
const subgraph_data = ({
|
const subgraph_data = ({
|
||||||
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.timeCost / d.memorized })),
|
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.memorized / d.timeCost })),
|
||||||
[SimulateWorkloadSubgraph.time]: data.map(d => ({ ...d, y: d.timeCost / d.learnSpan })),
|
[SimulateWorkloadSubgraph.time]: data.map(d => ({ ...d, y: d.timeCost / d.learnSpan })),
|
||||||
[SimulateWorkloadSubgraph.count]: data.map(d => ({ ...d, y: d.count / d.learnSpan })),
|
[SimulateWorkloadSubgraph.count]: data.map(d => ({ ...d, y: d.count / d.learnSpan })),
|
||||||
[SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })),
|
[SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })),
|
||||||
|
|
@ -215,9 +216,10 @@ function _renderSimulationChart<T extends { x: any; y: any; label: number }>(
|
||||||
// y scale
|
// y scale
|
||||||
|
|
||||||
const yMax = max(subgraph_data, d => d.y)!;
|
const yMax = max(subgraph_data, d => d.y)!;
|
||||||
|
const yMin = min(subgraph_data, d => d.y)!;
|
||||||
const y = scaleLinear()
|
const y = scaleLinear()
|
||||||
.range([bounds.height - bounds.marginBottom, bounds.marginTop])
|
.range([bounds.height - bounds.marginBottom, bounds.marginTop])
|
||||||
.domain([0, yMax])
|
.domain([yMin, yMax])
|
||||||
.nice();
|
.nice();
|
||||||
svg.select<SVGGElement>(".y-ticks")
|
svg.select<SVGGElement>(".y-ticks")
|
||||||
.call((selection) =>
|
.call((selection) =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue