@genspectrum/dashboard-components 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +16 -0
- package/dist/dashboard-components.js +43 -1
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +2 -2
- package/package.json +1 -1
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-line-chart.tsx +59 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +2 -1
- package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +11 -0
package/custom-elements.json
CHANGED
|
@@ -1891,6 +1891,14 @@
|
|
|
1891
1891
|
},
|
|
1892
1892
|
"default": "{ ...Template, play: async ({ canvasElement }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-number-sequences-over-time'); await waitFor(() => expect(canvas.getByRole('button', { name: 'Bar' })).toBeVisible()); await fireEvent.click(canvas.getByRole('button', { name: 'Bar' })); }, }"
|
|
1893
1893
|
},
|
|
1894
|
+
{
|
|
1895
|
+
"kind": "variable",
|
|
1896
|
+
"name": "OneDatasetLineChart",
|
|
1897
|
+
"type": {
|
|
1898
|
+
"text": "StoryObj<NumberSequencesOverTimeProps>"
|
|
1899
|
+
},
|
|
1900
|
+
"default": "{ ...Template, play: async ({ canvasElement }) => { const canvas = await withinShadowRoot(canvasElement, 'gs-number-sequences-over-time'); await waitFor(() => expect(canvas.getByRole('button', { name: 'Line' })).toBeVisible()); await fireEvent.click(canvas.getByRole('button', { name: 'Line' })); }, }"
|
|
1901
|
+
},
|
|
1894
1902
|
{
|
|
1895
1903
|
"kind": "variable",
|
|
1896
1904
|
"name": "OneDatasetTable",
|
|
@@ -1933,6 +1941,14 @@
|
|
|
1933
1941
|
"module": "src/web-components/visualization/gs-number-sequences-over-time.stories.ts"
|
|
1934
1942
|
}
|
|
1935
1943
|
},
|
|
1944
|
+
{
|
|
1945
|
+
"kind": "js",
|
|
1946
|
+
"name": "OneDatasetLineChart",
|
|
1947
|
+
"declaration": {
|
|
1948
|
+
"name": "OneDatasetLineChart",
|
|
1949
|
+
"module": "src/web-components/visualization/gs-number-sequences-over-time.stories.ts"
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1936
1952
|
{
|
|
1937
1953
|
"kind": "js",
|
|
1938
1954
|
"name": "OneDatasetTable",
|
|
@@ -7619,6 +7619,47 @@ const NumberSequencesOverTimeBarChart = ({ data }) => {
|
|
|
7619
7619
|
const config = T(
|
|
7620
7620
|
() => ({
|
|
7621
7621
|
type: "bar",
|
|
7622
|
+
data: {
|
|
7623
|
+
datasets: getDatasets$1(data)
|
|
7624
|
+
},
|
|
7625
|
+
options: {
|
|
7626
|
+
maintainAspectRatio: false,
|
|
7627
|
+
animation: false,
|
|
7628
|
+
plugins: {
|
|
7629
|
+
legend: {
|
|
7630
|
+
display: false
|
|
7631
|
+
},
|
|
7632
|
+
tooltip: {
|
|
7633
|
+
mode: "index",
|
|
7634
|
+
intersect: false
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
}
|
|
7638
|
+
}),
|
|
7639
|
+
[data]
|
|
7640
|
+
);
|
|
7641
|
+
return /* @__PURE__ */ u$1(GsChart, { configuration: config });
|
|
7642
|
+
};
|
|
7643
|
+
const getDatasets$1 = (data) => {
|
|
7644
|
+
const tableData = getNumberOfSequencesOverTimeTableData(data, "date");
|
|
7645
|
+
return data.map(
|
|
7646
|
+
({ displayName }, index) => ({
|
|
7647
|
+
borderWidth: 1,
|
|
7648
|
+
label: displayName,
|
|
7649
|
+
backgroundColor: singleGraphColorRGBAById(index, 0.3),
|
|
7650
|
+
borderColor: singleGraphColorRGBAById(index),
|
|
7651
|
+
data: tableData.map((row) => ({
|
|
7652
|
+
x: row.date,
|
|
7653
|
+
y: row[displayName]
|
|
7654
|
+
}))
|
|
7655
|
+
})
|
|
7656
|
+
);
|
|
7657
|
+
};
|
|
7658
|
+
Chart.register(...registerables);
|
|
7659
|
+
const NumberSequencesOverTimeLineChart = ({ data }) => {
|
|
7660
|
+
const config = T(
|
|
7661
|
+
() => ({
|
|
7662
|
+
type: "line",
|
|
7622
7663
|
data: {
|
|
7623
7664
|
datasets: getDatasets(data)
|
|
7624
7665
|
},
|
|
@@ -7645,6 +7686,7 @@ const getDatasets = (data) => {
|
|
|
7645
7686
|
return data.map(
|
|
7646
7687
|
({ displayName }, index) => ({
|
|
7647
7688
|
borderWidth: 1,
|
|
7689
|
+
pointRadius: 0,
|
|
7648
7690
|
label: displayName,
|
|
7649
7691
|
backgroundColor: singleGraphColorRGBAById(index, 0.3),
|
|
7650
7692
|
borderColor: singleGraphColorRGBAById(index),
|
|
@@ -7721,7 +7763,7 @@ const NumberSequencesOverTimeTabs = ({ views, data, granularity, pageSize }) =>
|
|
|
7721
7763
|
case "bar":
|
|
7722
7764
|
return { title: "Bar", content: /* @__PURE__ */ u$1(NumberSequencesOverTimeBarChart, { data }) };
|
|
7723
7765
|
case "line":
|
|
7724
|
-
return { title: "Line", content: /* @__PURE__ */ u$1(
|
|
7766
|
+
return { title: "Line", content: /* @__PURE__ */ u$1(NumberSequencesOverTimeLineChart, { data }) };
|
|
7725
7767
|
case "table":
|
|
7726
7768
|
return {
|
|
7727
7769
|
title: "Table",
|