UNPKG

@dschz/solid-uplot

Version:

SolidJS wrapper for uPlot — ultra-fast, tiny time-series & charting library

25 lines (22 loc) 683 B
import 'uplot'; // src/utils/getColorString.ts var getColorString = (fillOrStroke, fallback = "#888") => { return typeof fillOrStroke === "string" ? fillOrStroke : fallback; }; function getNewCalendarDayIndices(u) { const xValues = u.data[0]; if (!xValues || !xValues.length) return []; const seen = /* @__PURE__ */ new Set(); const indices = []; for (let i = 0; i < xValues.length; i++) { const ts = xValues[i]; const date = new Date(ts); const dayString = date.toISOString().split("T")[0]; if (!seen.has(dayString)) { seen.add(dayString); indices.push(i); } } return indices; } export { getColorString, getNewCalendarDayIndices };