diff --git a/plugins/analytics/client/charts/bot.ts b/plugins/analytics/client/charts/bot.ts index 18506c95..e596ddc9 100644 --- a/plugins/analytics/client/charts/bot.ts +++ b/plugins/analytics/client/charts/bot.ts @@ -9,7 +9,6 @@ export default (ctx: Context) => { fields: ['analytics'], showTab: true, options({ analytics }, tab) { - if (!Object.keys(analytics.messageByBot).length) return const data = Object .entries(analytics.messageByBot) .map(([key, value]) => ({ @@ -21,6 +20,10 @@ export default (ctx: Context) => { value: value[tab], })), })) + const total = data.reduce((sum, { children }) => { + return sum + children.reduce((sum, { value }) => sum + value, 0) + }, 0) + if (!total) return return { tooltip: Tooltip.item(({ data }) => { diff --git a/plugins/analytics/client/charts/hour.ts b/plugins/analytics/client/charts/hour.ts index 342b3038..081e84fe 100644 --- a/plugins/analytics/client/charts/hour.ts +++ b/plugins/analytics/client/charts/hour.ts @@ -41,7 +41,6 @@ export default (ctx: Context) => { type: 'value', }, series: [{ - name: '其他', data: analytics.messageByHour.map((val, index) => [index + 0.5, val[tab] || 0]), type: 'bar', stack: '1',