mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Fix for chart rendering (#8981)
- Graphs like numbers, not strings, I guess...
This commit is contained in:
parent
01b74da255
commit
0c56a3132b
@ -107,18 +107,19 @@ export default function PartStocktakeDetail({
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
accessor: 'quantity',
|
accessor: 'quantity',
|
||||||
sortable: true,
|
sortable: false,
|
||||||
switchable: false
|
switchable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessor: 'item_count',
|
accessor: 'item_count',
|
||||||
title: t`Stock Items`,
|
title: t`Stock Items`,
|
||||||
switchable: true,
|
switchable: true,
|
||||||
sortable: true
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessor: 'cost',
|
accessor: 'cost',
|
||||||
title: t`Stock Value`,
|
title: t`Stock Value`,
|
||||||
|
sortable: false,
|
||||||
render: (record: any) => {
|
render: (record: any) => {
|
||||||
return formatPriceRange(record.cost_min, record.cost_max, {
|
return formatPriceRange(record.cost_min, record.cost_max, {
|
||||||
currency: record.cost_min_currency
|
currency: record.cost_min_currency
|
||||||
@ -127,10 +128,11 @@ export default function PartStocktakeDetail({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessor: 'date',
|
accessor: 'date',
|
||||||
sortable: true
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessor: 'note'
|
accessor: 'note',
|
||||||
|
sortable: false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
@ -174,17 +176,15 @@ export default function PartStocktakeDetail({
|
|||||||
return {
|
return {
|
||||||
date: new Date(record.date).valueOf(),
|
date: new Date(record.date).valueOf(),
|
||||||
quantity: record.quantity,
|
quantity: record.quantity,
|
||||||
value_min: record.cost_min,
|
value_min: Number.parseFloat(record.cost_min),
|
||||||
value_max: record.cost_max
|
value_max: Number.parseFloat(record.cost_max)
|
||||||
};
|
};
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
|
|
||||||
// Sort records to ensure correct date order
|
// Sort records to ensure correct date order
|
||||||
records.sort((a, b) => {
|
return records.sort((a, b) => {
|
||||||
return a < b ? -1 : 1;
|
return a < b ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
return records;
|
|
||||||
}, [table.records]);
|
}, [table.records]);
|
||||||
|
|
||||||
// Calculate the date limits of the chart
|
// Calculate the date limits of the chart
|
||||||
@ -216,7 +216,8 @@ export default function PartStocktakeDetail({
|
|||||||
columns={tableColumns}
|
columns={tableColumns}
|
||||||
props={{
|
props={{
|
||||||
params: {
|
params: {
|
||||||
part: partId
|
part: partId,
|
||||||
|
ordering: 'date'
|
||||||
},
|
},
|
||||||
rowActions: rowActions,
|
rowActions: rowActions,
|
||||||
tableActions: tableActions
|
tableActions: tableActions
|
||||||
@ -241,6 +242,12 @@ export default function PartStocktakeDetail({
|
|||||||
<ChartTooltip label={label} payload={payload} />
|
<ChartTooltip label={label} payload={payload} />
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
yAxisProps={{
|
||||||
|
allowDataOverflow: false
|
||||||
|
}}
|
||||||
|
rightYAxisProps={{
|
||||||
|
allowDataOverflow: false
|
||||||
|
}}
|
||||||
xAxisProps={{
|
xAxisProps={{
|
||||||
scale: 'time',
|
scale: 'time',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user