mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 06:28:53 +00:00
feat(nui): WIP pie chart
This commit is contained in:
1 parent
79a4e4cca1
commit
b9442715e4
3 files changed
+453
-10
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, VStack, Center } from '@chakra-ui/react';
|
||||
import { Box, VStack, Center, Spacer, Flex } from '@chakra-ui/react';
|
||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||
import { VictoryPie, VictoryTooltip } from 'victory';
|
||||
import type { InitData } from '../../types';
|
||||
|
||||
const RightBar: React.FC = () => {
|
||||
@@ -13,12 +14,37 @@ const RightBar: React.FC = () => {
|
||||
});
|
||||
|
||||
return (
|
||||
<Box float="right" w="20%" h="max" p="1.2vh">
|
||||
<Center>
|
||||
<VStack align="left">
|
||||
<Box>Total number of queries: {initData.totalQueries}</Box>
|
||||
<Box>Total amount of time querying: {Math.trunc(initData.totalTime)} ms</Box>
|
||||
</VStack>
|
||||
<Box float="right" w="20%" h="100%" p="1.2vh">
|
||||
<Center h="100%">
|
||||
<Flex direction="column" h="100%">
|
||||
<Box>
|
||||
<VStack align="left">
|
||||
<Box>Number of queries: {initData.totalQueries}</Box>
|
||||
<Box>Time querying: {Math.trunc(initData.totalTime)} ms</Box>
|
||||
</VStack>
|
||||
</Box>
|
||||
<Spacer />
|
||||
<Box>
|
||||
<VictoryPie
|
||||
colorScale="qualitative"
|
||||
data={[
|
||||
{ x: 'ox_inventory', y: 63 },
|
||||
{ x: 'es_extended', y: 129 },
|
||||
{ x: 'luke_garages', y: 73 },
|
||||
]}
|
||||
labelComponent={<VictoryTooltip flyoutPadding={18} style={{ fontSize: 24 }} cornerRadius={15} />}
|
||||
style={{
|
||||
labels: {
|
||||
fill: 'black',
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: 28,
|
||||
},
|
||||
}}
|
||||
labels={({ datum }) => `${datum.x}: ${datum.y}ms`}
|
||||
labelPlacement="parallel"
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
</Center>
|
||||
</Box>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user