Skip to content

Commit

Permalink
fix: single column in chart grid (#122)
Browse files Browse the repository at this point in the history
* fix: single column in chart grid

* fix: css fix

Co-authored-by: Emily Bonar <emilykbonar@gmail.com>

---------

Co-authored-by: Emily Bonar <emilykbonar@gmail.com>
  • Loading branch information
keita-determined and emily-roses authored Apr 17, 2024
1 parent d3dd1f6 commit f128822
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 32 deletions.
65 changes: 37 additions & 28 deletions src/DesignKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1182,34 +1182,43 @@ const ChartsSection: React.FC = () => {
x-axis range. There will be a linear/log scale switch, and if multiple X-axis options are
provided, an X-axis switch.
</p>
{createChartGrid({
chartsProps: [
{
series: [line1],
showLegend: true,
title: 'Sample1',
xAxis,
xLabel: xAxis,
},
{
series: [line2, line3],
showLegend: true,
title: 'Sample2',
xAxis,
xLabel: xAxis,
},
{
series: [line1, line2, line3],
showLegend: true,
title: 'Sample3',
xAxis,
xLabel: xAxis,
},
],
handleError,
onXAxisChange: setXAxis,
xAxis: xAxis,
})}
<div style={{ height: 600 }}>
{createChartGrid({
chartsProps: [
{
series: [line1],
showLegend: true,
title: 'Sample1',
xAxis,
xLabel: xAxis,
},
{
series: [line2, line3],
showLegend: true,
title: 'Sample2',
xAxis,
xLabel: xAxis,
},
{
series: [line1, line2, line3],
showLegend: true,
title: 'Sample3',
xAxis,
xLabel: xAxis,
},
...Array.from(Array(10), (_, i) => ({
series: [line1, line2, line3],
showLegend: true,
title: `Sample${i + 4}`,
xAxis,
xLabel: xAxis,
})),
],
handleError,
onXAxisChange: setXAxis,
xAxis: xAxis,
})}
</div>
<hr />
<strong>Loading</strong>
{createChartGrid({
Expand Down
5 changes: 3 additions & 2 deletions src/kit/LineChart.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.gridBase {
height: 100%;
min-height: 150px;
overflow: auto;

.filterContainer {
margin-bottom: var(--spacing-lg);
padding-bottom: var(--spacing-lg);
}
.gridContainer {
display: grid;
gap: var(--spacing-xl);
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
grid-template-columns: auto;

.gridItem {
flex: 1;
Expand Down
16 changes: 14 additions & 2 deletions src/kit/internal/UPlot/UPlotChart.module.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
.base {
margin-bottom: 10px;
margin-top: 10px;
padding-block: var(--spacing-lg);
position: relative;

:global(.u-legend .u-marker) {
height: 2px;
}
:global(.u-legend) {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-xl);
margin: 0;
text-align: left;

* {
margin: 0;
}
th {
align-items: center;
display: flex;
gap: 4px;
}
}
}
.base.dark {
Expand Down

0 comments on commit f128822

Please sign in to comment.