mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-01 22:39:03 -07:00
34 lines
750 B
JavaScript
34 lines
750 B
JavaScript
import { createOrderedIndexes } from "../order.js";
|
|
import { createLinePathData } from "../path.js";
|
|
import { appendSeriesPath } from "../series-path.js";
|
|
import { createLineSeries } from "./series.js";
|
|
|
|
/**
|
|
* @param {PlotContext} context
|
|
*/
|
|
export function renderLinePlot({
|
|
group,
|
|
loadedSeries,
|
|
height,
|
|
highlight,
|
|
scale,
|
|
order,
|
|
}) {
|
|
const plottedSeries = createLineSeries(loadedSeries, height, scale);
|
|
const indexes = createOrderedIndexes(plottedSeries.length, order);
|
|
|
|
for (const index of indexes) {
|
|
const { color, points } = plottedSeries[index];
|
|
appendSeriesPath({
|
|
group,
|
|
highlight,
|
|
index,
|
|
chart: "line",
|
|
color,
|
|
d: createLinePathData(points),
|
|
});
|
|
}
|
|
|
|
return plottedSeries;
|
|
}
|