antvis / AVA

🤖 A framework for automated visual analytics.

Home Page:https://ava.antv.antgroup.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用Advisor的时候遇到了一个奇怪的问题。推荐图表不全!

yuanAIhan opened this issue · comments

  • Package Name:
  • Package Version:
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

首先当我使用的默认的推荐数据为:
const defaultData = [
{ price: 100, type: '2023-05-30' },
{ price: 120, type: '2023-05-21' },
{ price: 150, type: 'C' },
]
上述的数据推荐出来的图表包括了柱状图
image
但是当我把数据修改为:
const defaultData = [
{ price: 100, type: '2023-05-30' },
{ price: 120, type: '2023-05-21' },
{ price: 150, type: '2023-05-09' },
]
此时推荐出来的图表之中仅有:
image

使用上完全保持一致:
import { Advisor } from '@antv/ava'
const chartAdvisor = new Advisor()
const results = chartAdvisor?.advise({ data: defaultData })
console.log(results)

请问这kennel是因为什么呢?没有提供额外的多余的配置。

image
第二个数据中的 type 会被判定为日期类型的字段,目前在 ava 的推荐逻辑下,日期 + 指标 不会推荐柱状图。
第一个数据中混了一个 { price: 150, type: 'C' }, type 字段会被认定为一个普通的维度字段,就会推荐柱状图。

或者说为什么日期 + 指标 不会推荐柱状图呢?这是出于什么考虑呀?

或者说为什么日期 + 指标 不会推荐柱状图呢?这是出于什么考虑呀?

引用一段回答:“Bar graphs show data with blocks of different lengths, whereas line graphs show a series of points connected by straight lines. This leads to a very different appearance, but the biggest difference is that bar graphs are more versatile while line graphs are better for showing trends over time or another measure with a logical progression of values (such as distance from a given point). Bar graphs can also show frequency distributions (how often you observe different outcomes) much more effectively than line graphs.”
通常来讲,有时间的时候,都是以看趋势为主。因此,用折线图是更合理的。