Fixed eps chart
This commit is contained in:
parent
e9713cc60c
commit
d3cd94feb0
1 changed files with 11 additions and 15 deletions
|
@ -15,9 +15,8 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { EmployeeCount, Eps, getEmployees, getEps } from '@/api';
|
||||
import { Eps, getEps } from '@/api';
|
||||
import { defineLoader } from '@/api/loader';
|
||||
import { time } from 'ag-charts-community';
|
||||
import { DateTime } from 'luxon';
|
||||
import { roundTo } from 'round-to';
|
||||
import { onMounted, computed } from 'vue';
|
||||
|
@ -25,10 +24,9 @@ import { AgChartsVue } from 'ag-charts-vue3';
|
|||
|
||||
const renderer = (params: any) => ({
|
||||
title: params.title,
|
||||
content: DateTime.fromMillis(params.xValue).year + ': ' + roundTo(params.yValue, 0),
|
||||
content: DateTime.fromMillis(params.xValue).toFormat('yyyy-MM') + ': ' + roundTo(params.yValue, 4),
|
||||
});
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
tickers: string[],
|
||||
colors: string[]
|
||||
|
@ -49,26 +47,24 @@ const options = computed(() => {
|
|||
type: 'column',
|
||||
yKey: t,
|
||||
yName: t,
|
||||
fill: getTickerColor(t),
|
||||
stroke: getTickerColor(t),
|
||||
tooltip: { renderer: renderer },
|
||||
marker: {
|
||||
fill: getTickerColor(t),
|
||||
stroke: getTickerColor(t)
|
||||
}
|
||||
highlightStyle: {
|
||||
item: { fillOpacity: 0 },
|
||||
series: { enabled: false }
|
||||
},
|
||||
})),
|
||||
axes: [
|
||||
{
|
||||
type: 'time',
|
||||
type: 'category',
|
||||
position: 'bottom',
|
||||
tick: {
|
||||
interval: time.month.every(3, {
|
||||
snapTo: DateTime.utc(2000, 1, 1).toJSDate() // snap to solar year quarters
|
||||
})
|
||||
},
|
||||
label: {
|
||||
autoRotate: true,
|
||||
autoRotateAngle: 335,
|
||||
format: '%Y-%m'
|
||||
formatter: (params: any) => {
|
||||
return DateTime.fromMillis(parseInt(params.value)).toFormat('yyyy-MM');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Reference in a new issue