Convert profitdistro chart to use computed props

This commit is contained in:
Matthias 2022-09-02 20:37:18 +02:00
parent 159f69c141
commit 261b3fb947

View File

@ -50,13 +50,15 @@ export default defineComponent({
console.log('setup start'); console.log('setup start');
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
// registerTransform(ecStat.transform.histogram); // registerTransform(ecStat.transform.histogram);
const profits = props.trades.map((trade) => trade.profit_ratio);
// console.log(profits); // console.log(profits);
// const data = [[]]; // const data = [[]];
const bins = 10; const bins = 10;
const data = binData(profits, bins); const data = computed(() => {
console.log(profits, data); const profits = props.trades.map((trade) => trade.profit_ratio);
return binData(profits, bins);
});
const chartOptions = computed((): EChartsOption => { const chartOptions = computed((): EChartsOption => {
const chartOptionsLoc: EChartsOption = { const chartOptionsLoc: EChartsOption = {
@ -66,7 +68,7 @@ export default defineComponent({
}, },
backgroundColor: 'rgba(0, 0, 0, 0)', backgroundColor: 'rgba(0, 0, 0, 0)',
dataset: { dataset: {
source: data, source: data.value,
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',