[basic-example][m] - update data to breaking bad

- Fix LineChart and allow the use of URLs
- Add applyFullWidthDirective back
- Fix favicon
- Remove data_1.csv and data_2.csv in favour of data.csv
- Remove vestiges of Vercel
This commit is contained in:
Luccas Mateus de Medeiros Gomes
2023-04-27 21:38:48 -03:00
parent 4b5329a93e
commit 58ca032d3f
16 changed files with 61 additions and 347 deletions

View File

@@ -4,6 +4,8 @@ export default function LineChart({
data = [],
fullWidth = false,
title = "",
xAxis = "x",
yAxis = "y",
}) {
var tmp = data;
if (Array.isArray(data)) {
@@ -15,7 +17,7 @@ export default function LineChart({
const spec = {
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
title,
width: 500,
width: "container",
height: 300,
mark: {
type: "line",
@@ -34,16 +36,20 @@ export default function LineChart({
},
encoding: {
x: {
field: "x",
field: xAxis,
timeUnit: "year",
type: "temporal",
},
y: {
field: "y",
field: yAxis,
type: "quantitative",
},
},
};
if (typeof data === 'string') {
spec.data = { "url": data } as any
return <VegaLite fullWidth={fullWidth} spec={spec} />;
}
return <VegaLite fullWidth={fullWidth} data={vegaData} spec={spec} />;
}

View File

@@ -1,6 +1,9 @@
// Wrapper for the Vega Lite component
import { VegaLite as VegaLiteOg } from "react-vega";
import applyFullWidthDirective from "../lib/applyFullWidthDirective";
export default function VegaLite(props) {
return <VegaLiteOg {...props} />;
const Component = applyFullWidthDirective({ Component: VegaLiteOg });
return <Component {...props} />;
}