diff --git a/rslib/src/scheduler/fsrs/simulator.rs b/rslib/src/scheduler/fsrs/simulator.rs index 005f7ca86..ef329ee59 100644 --- a/rslib/src/scheduler/fsrs/simulator.rs +++ b/rslib/src/scheduler/fsrs/simulator.rs @@ -292,7 +292,8 @@ impl Collection { Ok(( 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::(), result.review_cnt_per_day.iter().sum::() as u32 + result.learn_cnt_per_day.iter().sum::() as u32, diff --git a/ts/routes/graphs/simulator.ts b/ts/routes/graphs/simulator.ts index feba9ce57..dbd4a4e7b 100644 --- a/ts/routes/graphs/simulator.ts +++ b/ts/routes/graphs/simulator.ts @@ -8,6 +8,7 @@ import { bisector, line, max, + min, pointer, rollup, scaleLinear, @@ -62,7 +63,7 @@ export function renderWorkloadChart( .range([bounds.marginLeft, bounds.width - bounds.marginRight]); 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.count]: data.map(d => ({ ...d, y: d.count / d.learnSpan })), [SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })), @@ -215,9 +216,10 @@ function _renderSimulationChart( // y scale const yMax = max(subgraph_data, d => d.y)!; + const yMin = min(subgraph_data, d => d.y)!; const y = scaleLinear() .range([bounds.height - bounds.marginBottom, bounds.marginTop]) - .domain([0, yMax]) + .domain([yMin, yMax]) .nice(); svg.select(".y-ticks") .call((selection) =>