forked from TransformerOptimus/SuperAGI
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format frontend code (TransformerOptimus#782)
* format code * image file issue * minor fixes * agent create scroll bug fixed * minor fixes --------- Co-authored-by: NishantBorthakur <nist.16br@gmail.com>
- Loading branch information
1 parent
9741d44
commit 6b8c80d
Showing
30 changed files
with
1,715 additions
and
1,525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ | |
|
||
.apm_dashboard { | ||
margin-top: 16px; | ||
height: calc(100vh - 14vh); | ||
height: calc(100vh - 16vh); | ||
overflow-y: auto; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,73 @@ | ||
import React, { useEffect, useRef } from "react"; | ||
import React, {useEffect, useRef} from "react"; | ||
import * as echarts from 'echarts'; | ||
import {formatNumber} from "@/utils/utils"; | ||
|
||
export const BarGraph = ({ data, type, color }) => { | ||
const chartRef = useRef(null); | ||
const containerRef = useRef(null); | ||
export const BarGraph = ({data, type, color}) => { | ||
const chartRef = useRef(null); | ||
const containerRef = useRef(null); | ||
|
||
useEffect(() => { | ||
const chartInstance = echarts.getInstanceByDom(chartRef.current); | ||
const chart = chartInstance ? chartInstance : echarts.init(chartRef.current); | ||
useEffect(() => { | ||
const chartInstance = echarts.getInstanceByDom(chartRef.current); | ||
const chart = chartInstance ? chartInstance : echarts.init(chartRef.current); | ||
|
||
const option = { | ||
color: color, | ||
tooltip: { | ||
trigger: 'axis', | ||
axisPointer: { | ||
type: 'shadow' | ||
} | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
data: data.map(item => item.name), | ||
axisLabel: { | ||
interval: 0, | ||
rotate: 45, | ||
color: '#888' | ||
} | ||
}, | ||
yAxis: { | ||
type: 'value', | ||
axisLabel: { | ||
formatter: function(value) { | ||
if (value >= 1000) { | ||
return `${value / 1000}k`; | ||
} else { | ||
return value; | ||
} | ||
} | ||
}, | ||
splitLine: { | ||
lineStyle: { | ||
color: 'rgba(255, 255, 255, 0.08)' | ||
} | ||
} | ||
}, | ||
series: [{ | ||
data: data.map(item => type === 'tokens_per_call' ? (item.tokens_consumed/item.calls) : item[type]), | ||
type: 'bar' | ||
}], | ||
responsive: true | ||
}; | ||
const option = { | ||
color: color, | ||
tooltip: { | ||
trigger: 'axis', | ||
axisPointer: { | ||
type: 'shadow' | ||
} | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
data: data.map(item => item.name), | ||
axisLabel: { | ||
interval: 0, | ||
rotate: 45, | ||
color: '#888' | ||
} | ||
}, | ||
yAxis: { | ||
type: 'value', | ||
axisLabel: { | ||
formatter: function (value) { | ||
if (value >= 1000) { | ||
return `${value / 1000}k`; | ||
} else { | ||
return value; | ||
} | ||
} | ||
}, | ||
splitLine: { | ||
lineStyle: { | ||
color: 'rgba(255, 255, 255, 0.08)' | ||
} | ||
} | ||
}, | ||
series: [{ | ||
data: data.map(item => type === 'tokens_per_call' ? (item.tokens_consumed / item.calls) : item[type]), | ||
type: 'bar' | ||
}], | ||
responsive: true | ||
}; | ||
|
||
chart.setOption(option); | ||
chart.setOption(option); | ||
|
||
const resizeObserver = new ResizeObserver(entries => { | ||
entries.forEach(entry => { | ||
chart.resize(); | ||
}); | ||
}); | ||
const resizeObserver = new ResizeObserver(entries => { | ||
entries.forEach(entry => { | ||
chart.resize(); | ||
}); | ||
}); | ||
|
||
resizeObserver.observe(containerRef.current); | ||
resizeObserver.observe(containerRef.current); | ||
|
||
return () => resizeObserver.disconnect(); | ||
}, [data, type]); | ||
return () => resizeObserver.disconnect(); | ||
}, [data, type]); | ||
|
||
return ( | ||
<div ref={containerRef} style={{ width: '100%', height: '100%' }}> | ||
<div ref={chartRef} style={{ width: '100%', height: '100%' }}></div> | ||
</div> | ||
); | ||
return ( | ||
<div ref={containerRef} style={{width: '100%', height: '100%'}}> | ||
<div ref={chartRef} style={{width: '100%', height: '100%'}}></div> | ||
</div> | ||
); | ||
} | ||
|
||
export default BarGraph; |
Oops, something went wrong.