Skip to content

BREAKING CHANGE: update the implementation and configuration of the V… #2984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 19, 2025

Conversation

lxfu1
Copy link
Member

@lxfu1 lxfu1 commented Jun 18, 2025

  • 文档修改,如下
  • violinType 的配置耦合了图形和坐标系,拆成两个配置:box + coordinateType

简介

小提琴图(Violin)是一种用于可视化连续变量分布概率密度的图表类型,通过核密度估计(Kernel Density Estimation, KDE) 将离散数据点转化为平滑的连续概率密度曲线,直观反映数据的集中趋势、分布形态及异常值。

Violin 的核心目标是从散点或点云数据中提取出其整体分布模式,并将其密度信息映射为一个连续的区域图或渐变效果。这种图表通常用于分析大量数据点的聚集区域、数据集中热点或数据分布的概率密度,例如在地理可视化中用于表示人口分布的密集程度,或者在分析中展示交易频率的区域性。

代码演示

更多示例详见小提琴图

基础用法

核密度图

极坐标小提琴图

配置项

概览

配置项 说明 类型 默认值
data 数据 Array []
xField 横轴字段 string -
yField 纵轴字段 string | string[] -
seriesField 分组字段 string(可选) -
colorField 颜色映射字段,详见color string(可选) -
box 是否叠加 boxplot 图形 boolean false
coordinateType 坐标系类型,支持直角坐标和极坐标 cartesian | polar cartesian
title 用于指定图表的标题内容,详见标题 object(可选) -
legend 图表的辅助元素,使用颜色、大小、形状区分不同的数据类型,用于图表中数据的筛选,详见图例 object(可选) -
label 数据标签是给图表添加标注的手段之一,详见标签 object(可选) -
tooltip 用于动态展示数据点的详细信息,详见提示 object(可选) -
style 视觉样式,配置项详见绘图属性 object(可选) -
theme 用于控制图表的整体外观,包括颜色、字体、边距等视觉属性,详见主题 string | object(可选) light
onReady 图表加载回调,用于后续的事件事件绑定 Function(可选) -
scale 将抽象数据映射为视觉数据,详见比例尺 object(可选) -
animate 动画作为可视化的重要组成部分,能显著提高数据可视化的表现力,详见动画 object(可选) -
interaction 提供了按需探索数据的能力,详见交互 object(可选) -
state 实现交互反馈、高亮、选中等效果,详见状态,不同交互下图表样式 object(可选) -
annotations 视图好比一个画板,Violin 组件默认在其上绘制了一个柱状图,我们可以通过 annotations 在上面叠加更多的图层,详见标注 Array(可选) -

事件

详见选项-事件

方法

详见图表概览-图表方法

@hustcc
Copy link
Collaborator

hustcc commented Jun 18, 2025

这是啥改动?

@lxfu1
Copy link
Member Author

lxfu1 commented Jun 18, 2025

这是啥改动?

image

之前 Violin 设计不合理,把坐标系、Mark 类型冗余到一起了,写文档发现的,还有一些不合理的,我提 issue 了。

@hustcc
Copy link
Collaborator

hustcc commented Jun 18, 2025

boxplot 改成 box 吧。boxplot 都是一个图表的名字了。G2 里面的 也是这样的?

@lxfu1
Copy link
Member Author

lxfu1 commented Jun 18, 2025

boxplot 改成 box 吧。boxplot 都是一个图表的名字了。G2 里面的 也是这样的?

G2 实现是,chart.boxplot()

@hustcc
Copy link
Collaborator

hustcc commented Jun 18, 2025

G2 实现是,chart.boxplot()

不是,G2 的 violin 有 boxplot = boolean 的配置吗?如果没有,我还是建议用 box 代替 boxplot 的命名。

@lxfu1
Copy link
Member Author

lxfu1 commented Jun 18, 2025

G2 实现是,chart.boxplot()

不是,G2 的 violin 有 boxplot = boolean 的配置吗?如果没有,我还是建议用 box 代替 boxplot 的命名。

没有,G2 里面 boxboxplot 是两个相似的 Mark,boxplot 支持配置异常值,而且能自动数据聚合,按理说 boxplot 合适一点。

@lxfu1 lxfu1 merged commit 64b1c2e into v2 Jun 19, 2025
8 checks passed
@lxfu1 lxfu1 deleted the breaking/violin-component branch June 19, 2025 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants