chore: barchart testing, formatBytes in y-axis legend

This commit is contained in:
2025-07-12 21:45:21 -05:00
parent 0f5558ec11
commit 0731a59486

View File

@@ -1,8 +1,8 @@
import { useState } from "react"; import { useState } from "react";
import logo from "./assets/images/logo-universal.png";
import "./App.css"; import "./App.css";
import { Greet } from "../wailsjs/go/main/App.js"; import { Greet } from "../wailsjs/go/main/App.js";
import { ResponsiveLine } from "@nivo/line"; import { ResponsiveLine } from "@nivo/line";
import { formatBytes } from "./lib/format.js";
function App() { function App() {
const [resultText, setResultText] = useState( const [resultText, setResultText] = useState(
@@ -285,13 +285,13 @@ function App() {
} }
return ( return (
<div id="App" className="min-h-screen min-w-screen"> <div id="App" className="min-h-screen min-w-screen overflow-hidden">
<ResponsiveLine /* or Line for fixed dimensions */ <ResponsiveLine
data={data} data={data}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }} margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
yScale={{ yScale={{
type: "linear", type: "linear",
min: "auto", min: 0,
max: "auto", max: "auto",
stacked: true, stacked: true,
reverse: false, reverse: false,
@@ -331,10 +331,22 @@ function App() {
}, },
}} }}
axisBottom={{ legend: "transportation", legendOffset: 36 }} axisBottom={{ legend: "transportation", legendOffset: 36 }}
axisLeft={{ legend: "count", legendOffset: -40 }} axisLeft={{
legend: "count",
legendOffset: -40,
format: (v) => formatBytes(v * 1024 * 53),
}}
pointSize={10} pointSize={10}
pointColor={{ modifiers: [["brighter", 1100]], from: "" }} colors={[
pointBorderWidth={2} "#3e8faf",
"#c4a7e7",
"#f5c276",
"#EA9B96",
"#EB7092",
"#9CCFD8",
]}
// pointColor={{ modifiers: [["brighter", 1100]] }}
pointBorderWidth={0}
pointBorderColor={{ from: "seriesColor" }} pointBorderColor={{ from: "seriesColor" }}
pointLabelYOffset={-12} pointLabelYOffset={-12}
enableSlices={"x"} enableSlices={"x"}