Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LineChart] initial LineChart #3611

Merged
merged 145 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
eaad9f3
Fix dedupe check
Janpot Mar 26, 2024
d36dad1
Merge remote-tracking branch 'upstream/master'
Janpot Mar 26, 2024
413c7bf
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
9268da2
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
a755a3d
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
efbc979
Merge remote-tracking branch 'upstream/master'
Janpot Apr 4, 2024
9676ffd
Merge remote-tracking branch 'upstream/master'
Janpot Apr 5, 2024
703d127
Merge remote-tracking branch 'upstream/master'
Janpot Apr 7, 2024
1dc5912
Merge remote-tracking branch 'upstream/master'
Janpot Apr 8, 2024
34cc01f
Merge remote-tracking branch 'upstream/master'
Janpot Apr 9, 2024
3c1e6e8
Merge remote-tracking branch 'upstream/master'
Janpot Apr 11, 2024
c86f22b
Merge remote-tracking branch 'upstream/master'
Janpot Apr 15, 2024
d3399a1
Merge remote-tracking branch 'upstream/master'
Janpot Apr 15, 2024
9c901cd
Merge remote-tracking branch 'upstream/master'
Janpot Apr 17, 2024
701b6a7
Merge remote-tracking branch 'upstream/master'
Janpot Apr 17, 2024
718ae37
Merge remote-tracking branch 'upstream/master'
Janpot Apr 18, 2024
52af240
Merge remote-tracking branch 'upstream/master'
Janpot Apr 21, 2024
0d4ed0c
Merge remote-tracking branch 'upstream/master'
Janpot Apr 24, 2024
24e57a7
Merge remote-tracking branch 'upstream/master'
Janpot Apr 26, 2024
169871c
Merge remote-tracking branch 'upstream/master'
Janpot Apr 30, 2024
5f05493
Merge remote-tracking branch 'upstream/master'
Janpot May 2, 2024
50c781a
Merge remote-tracking branch 'upstream/master'
Janpot May 2, 2024
2c067b0
Merge remote-tracking branch 'upstream/master'
Janpot May 3, 2024
d057f7e
Merge remote-tracking branch 'upstream/master'
Janpot May 6, 2024
f839a69
Merge remote-tracking branch 'upstream/master'
Janpot May 7, 2024
e425fae
Merge remote-tracking branch 'upstream/master'
Janpot May 9, 2024
0722ee1
Merge remote-tracking branch 'upstream/master'
Janpot May 13, 2024
7afd082
Merge remote-tracking branch 'upstream/master'
Janpot May 14, 2024
dfeb968
Merge remote-tracking branch 'upstream/master'
Janpot May 15, 2024
fd2f5a6
initial commit
Janpot May 15, 2024
d2b3373
wip docs start
Janpot May 16, 2024
0ff6776
dialogs
Janpot May 16, 2024
6dc1953
dfwerf
Janpot May 16, 2024
c803a60
Update collections.ts
Janpot May 16, 2024
da1c968
fix type checking
Janpot May 16, 2024
d4b1224
frete
Janpot May 16, 2024
e5aaedd
dwfwe
Janpot May 16, 2024
bc326f0
Update collections.ts
Janpot May 16, 2024
2496e10
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 16, 2024
5a752ac
Delete coreTypeScriptProjects.js
Janpot May 16, 2024
8d6577c
dwefrf
Janpot May 16, 2024
40c558b
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 16, 2024
55f33ed
dew
Janpot May 17, 2024
efa4459
def
Janpot May 17, 2024
b1eefb0
notifications
Janpot May 17, 2024
4a481bc
Update react.tsx
Janpot May 17, 2024
79925d0
Update react.tsx
Janpot May 17, 2024
9e6c669
dfwf
Janpot May 17, 2024
9608fa1
close notification
Janpot May 17, 2024
bf85007
Update DataGrid.tsx
Janpot May 17, 2024
6fc7887
preview
Janpot May 17, 2024
7fc764f
yep
Janpot May 17, 2024
0ca6403
demo
Janpot May 17, 2024
8e3fde5
keep original
Janpot May 17, 2024
c327f3f
better preview
Janpot May 17, 2024
17e982a
first grid demo
Janpot May 17, 2024
93c7cbb
Merge remote-tracking branch 'upstream/master'
Janpot May 21, 2024
e1e5af8
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 21, 2024
44db041
Update README.md
Janpot May 21, 2024
a377864
fregre
Janpot May 21, 2024
9fa4004
dewf
Janpot May 21, 2024
18de559
Update _app.js
Janpot May 21, 2024
4ecf2ea
Update _app.js
Janpot May 21, 2024
98fb67c
Update _app.js
Janpot May 21, 2024
e51554a
Update _app.js
Janpot May 21, 2024
534bafb
Update _app.js
Janpot May 21, 2024
810ee96
Update _app.js
Janpot May 21, 2024
06e93a0
Update package.json
Janpot May 21, 2024
1d66662
Update package.json
Janpot May 21, 2024
9145b94
Update pnpm-lock.yaml
Janpot May 21, 2024
3d0ed32
dwef
Janpot May 21, 2024
b68008d
Update DataProvider.tsx
Janpot May 21, 2024
806d732
dewrw
Janpot May 21, 2024
08b7cd5
Merge branch 'master' into datagrid
Janpot May 22, 2024
457c844
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 22, 2024
2974056
Update dashboard-layout.js
Janpot May 22, 2024
03fef90
Delete data-provider.js
Janpot May 22, 2024
342fe2c
Update coreTypescriptProjects.js
Janpot May 22, 2024
dd0ee0e
dwekj
Janpot May 22, 2024
86d5cef
Update InferrencingAlert.tsx
Janpot May 22, 2024
25634b9
Merge branch 'master' into datagrid
Janpot May 22, 2024
6540fe2
dew
Janpot May 22, 2024
664bfa4
dialogs
Janpot May 22, 2024
5c92557
notifs
Janpot May 22, 2024
5bdfa26
dewrfw
Janpot May 22, 2024
741de3c
freg
Janpot May 23, 2024
41a5c59
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 23, 2024
5db5f22
API
Janpot May 23, 2024
7b25099
API pages
Janpot May 23, 2024
fdc61fd
Test outline
Janpot May 23, 2024
aec4072
dfwef
Janpot May 23, 2024
390138c
Update DataGrid.tsx
Janpot May 23, 2024
b98cad1
werfrw
Janpot May 23, 2024
0d211c8
dewr
Janpot May 23, 2024
bea8bde
Update DashboardLayout.tsx
Janpot May 23, 2024
0af2eb9
fwref
Janpot May 23, 2024
34b6da4
dfwefwref
Janpot May 23, 2024
e179a19
Update InferrencingAlert.tsx
Janpot May 23, 2024
57bcefb
sh
Janpot May 23, 2024
f6a9e85
CRUD
Janpot May 23, 2024
e08937c
go
Janpot May 23, 2024
79f3480
writing
Janpot May 23, 2024
6be4eba
remove dialog provider from demos
Janpot May 23, 2024
0d3a286
notifications
Janpot May 24, 2024
6a4492f
remove cache provider
Janpot May 24, 2024
7311155
add comment
Janpot May 24, 2024
2a7b050
Update DataProvider.tsx
Janpot May 24, 2024
9c81f9c
Delete data-provider.json
Janpot May 24, 2024
dee9a2c
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 24, 2024
8b2d362
frwwt
Janpot May 24, 2024
5702952
remove dialog/notifications
Janpot May 24, 2024
86ca56f
Update AppProvider.tsx
Janpot May 24, 2024
c2cfd7a
Update index.ts
Janpot May 24, 2024
c429048
Update pnpm-lock.yaml
Janpot May 24, 2024
62076bc
Update InferrencingAlert.tsx
Janpot May 24, 2024
17a028d
Update pnpm-lock.yaml
Janpot May 24, 2024
2748241
WIP
Janpot May 24, 2024
5b41299
LineChart
Janpot May 28, 2024
e3c0cd4
Merge remote-tracking branch 'upstream/master' into tutorial
Janpot May 28, 2024
baca199
remove unused
Janpot May 28, 2024
4af7593
dwefqe
Janpot May 28, 2024
f207a0f
fix
Janpot May 28, 2024
94712bb
Merge remote-tracking branch 'upstream/master' into tutorial
Janpot May 29, 2024
183e3a1
update tut
Janpot May 29, 2024
ce5c3b2
Update LineChart.tsx
Janpot May 29, 2024
d79430c
tutorial
Janpot May 29, 2024
66281e0
grefer
Janpot May 29, 2024
2bac52c
Update index.ts
Janpot May 29, 2024
e1cbf2c
Update LineChart.tsx
Janpot May 29, 2024
0dd64df
Update LineChart.tsx
Janpot May 29, 2024
027cc6f
dewr
Janpot May 29, 2024
e1d97cc
fwere
Janpot May 29, 2024
e5ed0db
Update .eslintignore
Janpot May 29, 2024
16023c6
erwt
Janpot May 29, 2024
bc216d1
ewr
Janpot May 29, 2024
5800f62
Update pnpm-lock.yaml
Janpot May 29, 2024
a8bfc60
Update LineChart.test.tsx
Janpot May 29, 2024
48425a9
Update LineChart.tsx
Janpot May 29, 2024
06665a9
fwerfrw
Janpot May 29, 2024
9048f72
check
Janpot May 29, 2024
d9e3d45
ffwrge
Janpot May 29, 2024
af3c59b
proptypes
Janpot May 29, 2024
9b3746b
inheritance
Janpot May 29, 2024
7c90e67
dwer
Janpot May 29, 2024
4509bf4
Merge remote-tracking branch 'upstream/master' into tutorial
Janpot May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ jobs:
command: |
pnpm prettier:all
pnpm check-changes
- run:
name: '`pnpm proptypes` changes committed?'
command: |
pnpm proptypes
pnpm check-changes
- run:
name: '`pnpm jsonSchemas` changes committed?'
command: |
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ build
/test/integration/*/fixture*/
/test/visual/*/fixture*/

.generated
.generated
.github
2 changes: 1 addition & 1 deletion docs/data/toolpad/core/components/data-grid/data-grid.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
productId: toolpad-core
title: App Provider
title: DataGrid
components: DataGrid, DataProvider
---

Expand Down
30 changes: 30 additions & 0 deletions docs/data/toolpad/core/components/line-chart/BasicLineChart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
return {
rows: [
{ id: 1, value: 19 },
{ id: 2, value: 34 },
{ id: 3, value: 6 },
{ id: 4, value: 14 },
{ id: 5, value: 17 },
],
};
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function BasicLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart height={250} dataProvider={myData} />
</Box>
);
}
30 changes: 30 additions & 0 deletions docs/data/toolpad/core/components/line-chart/BasicLineChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
return {
rows: [
{ id: 1, value: 19 },
{ id: 2, value: 34 },
{ id: 3, value: 6 },
{ id: 4, value: 14 },
{ id: 5, value: 17 },
],
};
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function BasicLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart height={250} dataProvider={myData} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<LineChart height={250} dataProvider={myData} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
return {
rows: [
{ id: 1, value: 19 },
{ id: 2, value: 34 },
{ id: 3, value: 6 },
{ id: 4, value: 14 },
{ id: 5, value: 17 },
],
};
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function CustomizedLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart
height={250}
dataProvider={myData}
series={[
{
dataKey: 'value',
label: 'Custom Label',
color: 'red',
area: true,
showMark: false,
},
]}
/>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
return {
rows: [
{ id: 1, value: 19 },
{ id: 2, value: 34 },
{ id: 3, value: 6 },
{ id: 4, value: 14 },
{ id: 5, value: 17 },
],
};
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function CustomizedLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart
height={250}
dataProvider={myData}
series={[
{
dataKey: 'value',
label: 'Custom Label',
color: 'red',
area: true,
showMark: false,
},
]}
/>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<LineChart
height={250}
dataProvider={myData}
series={[
{
dataKey: 'value',
label: 'Custom Label',
color: 'red',
area: true,
showMark: false,
},
]}
/>
22 changes: 22 additions & 0 deletions docs/data/toolpad/core/components/line-chart/ErrorLineChart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
throw new Error('Failed to fetch data');
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function ErrorLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart height={150} dataProvider={myData} />
</Box>
);
}
22 changes: 22 additions & 0 deletions docs/data/toolpad/core/components/line-chart/ErrorLineChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const myData = createDataProvider({
async getMany() {
throw new Error('Failed to fetch data');
},
fields: {
id: { label: 'ID' },
value: { label: 'Value', type: 'number' },
},
});

export default function ErrorLineChart() {
return (
<Box sx={{ width: '100%' }}>
<LineChart height={150} dataProvider={myData} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<LineChart height={150} dataProvider={myData} />
27 changes: 27 additions & 0 deletions docs/data/toolpad/core/components/line-chart/line-chart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
productId: toolpad-core
title: Line Chart
components: LineChart
---

# Line Chart

<p class="description">Line Chart component for Toolpad Core applications.</p>

Toolpad Core extends X Charts with data provider support. Toolpad Core charts automatically load data and adopt defaults for labels and formatting.

## Basic example

Add a data provider to a chart and its data is automatically loaded in the chart.

{{"demo": "BasicLineChart.js"}}

Error and loading states are automatically handled. Errors from the data provider are shown in an overlay:

{{"demo": "ErrorLineChart.js", "hideToolbar": true}}

## Customization

The chart automatically adopts configuration from the data provider. When you pick a `dataKey` for an axis or a series, the chart automatically infers default values for series and axis options. The Toolpad Core components accept all properties that the X components offer. SO to customize the chart further, you can override these defaults and add extra options as you need.

{{"demo": "CustomizedLineChart.js"}}
7 changes: 4 additions & 3 deletions docs/data/toolpad/core/introduction/Tutorial1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const npmData = createDataProvider({
async getMany() {
const res = await fetch('https://api.npmjs.org/downloads/range/last-year/react');
if (!res.ok) {
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
const { error } = await res.json();
throw new Error(`HTTP ${res.status}: ${error}`);
}
const { downloads } = await res.json();
return { rows: downloads };
Expand All @@ -21,8 +22,8 @@ const npmData = createDataProvider({

export default function Tutorial1() {
return (
<Box sx={{ height: 300, width: '100%' }}>
<DataGrid dataProvider={npmData} />
<Box sx={{ width: '100%' }}>
<DataGrid height={300} dataProvider={npmData} />
</Box>
);
}
7 changes: 4 additions & 3 deletions docs/data/toolpad/core/introduction/Tutorial1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const npmData = createDataProvider({
async getMany() {
const res = await fetch('https://api.npmjs.org/downloads/range/last-year/react');
if (!res.ok) {
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
const { error } = await res.json();
throw new Error(`HTTP ${res.status}: ${error}`);
}
const { downloads } = await res.json();
return { rows: downloads };
Expand All @@ -21,8 +22,8 @@ const npmData = createDataProvider({

export default function Tutorial1() {
return (
<Box sx={{ height: 300, width: '100%' }}>
<DataGrid dataProvider={npmData} />
<Box sx={{ width: '100%' }}>
<DataGrid height={300} dataProvider={npmData} />
</Box>
);
}
2 changes: 1 addition & 1 deletion docs/data/toolpad/core/introduction/Tutorial1.tsx.preview
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<DataGrid dataProvider={npmData} />
<DataGrid height={300} dataProvider={npmData} />
36 changes: 36 additions & 0 deletions docs/data/toolpad/core/introduction/Tutorial2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const npmData = createDataProvider({
async getMany() {
const res = await fetch('https://api.npmjs.org/downloads/range/last-year/react');
if (!res.ok) {
const { error } = await res.json();
throw new Error(`HTTP ${res.status}: ${error}`);
}
const { downloads } = await res.json();
return { rows: downloads };
},
idField: 'day',
fields: {
day: { type: 'date' },
downloads: { type: 'number' },
},
});

export default function Tutorial2() {
return (
<Box sx={{ width: '100%' }}>
<DataGrid height={300} dataProvider={npmData} />
<LineChart
height={300}
dataProvider={npmData}
xAxis={[{ dataKey: 'day' }]}
series={[{ dataKey: 'downloads' }]}
/>
</Box>
);
}
36 changes: 36 additions & 0 deletions docs/data/toolpad/core/introduction/Tutorial2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import { LineChart } from '@toolpad/core/LineChart';
import Box from '@mui/material/Box';

const npmData = createDataProvider({
async getMany() {
const res = await fetch('https://api.npmjs.org/downloads/range/last-year/react');
if (!res.ok) {
const { error } = await res.json();
throw new Error(`HTTP ${res.status}: ${error}`);
}
const { downloads } = await res.json();
return { rows: downloads };
},
idField: 'day',
fields: {
day: { type: 'date' },
downloads: { type: 'number' },
},
});

export default function Tutorial2() {
return (
<Box sx={{ width: '100%' }}>
<DataGrid height={300} dataProvider={npmData} />
<LineChart
height={300}
dataProvider={npmData}
xAxis={[{ dataKey: 'day' }]}
series={[{ dataKey: 'downloads' }]}
/>
</Box>
);
}
Loading
Loading