VisActor / VisActor/VTable

[Feature] 透视组合图支持对series数据的单独配置

Open
#2,968 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
3.7k
Forks
486
Avg merge
1d 19h
Merged PRs (30d)
16

Description

What problem does this feature solve?

image

What does the proposed API look like?

VTable.register.chartModule('vchart', VChart);
let tableInstance;
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_Pivot_Chart_data.json')
.then(res => res.json())
.then(data => {

const option = {
"indicators": [
{
"indicatorKey": "indicator_val_0",
"chartSpec": {
"series": [
{
"data": {
"id": "2e43490a5e5d45dd80273cb5bba42e71",
"fields": {
"series_field_01": {
"sortIndex": 1,
"domain": [
"办公用品 ",
"技术 ",
"家具 "
]
}
}
},
"yField": "indicator_val_0",
"seriesField": "series_field_01",
"type": "bar",
"xField": [
"segmentation",
"indicator_key_0"
],
"width": "auto",
"size": 18,
"tooltip": {
"mark": {
"content": [
{
key:datum => {
return datum['segmentation'] || datum['segmentation'] === 0 ? '细分' : null
},
},
{
key:datum => {
return datum['col_fld_tmp_zb_3'] || datum['col_fld_tmp_zb_3'] === 0 ? '计划发货天数' : null
},
}
]
},
},
"stack": true
},
{
"data": {
"id": "f5a88eb3dbea45feb905c7384df30f14",
"fields": {
"series_field_01": {
"sortIndex": 1,
"domain": [
"办公用品 ",
"技术 ",
"家具 "
]
}
}
},
"yField": "indicator_val_0",
"seriesField": "series_field_01",
"type": "bar",
"xField": [
"segmentation",
"indicator_key_0"
],
"width": "auto",
"size": 18,
"tooltip": {
"mark": {
"content": [
{
key:datum => {
return datum['segmentation'] || datum['segmentation'] === 0 ? '细分' : null
},
},
{
key:datum => {
return datum['col_fld_tmp_zb_5'] || datum['col_fld_tmp_zb_5'] === 0 ? '实际发货天数' : null
},
}
]
},
},
"stack": true
}
],
"type": "common",
"stack": true
},
"title": [
"计划发货天数/实际发货天数"
],
"cellType": "chart",
"chartModule": "vchart",
"width": "auto",
"headerStyle": {
"borderLineWidth": [
1,
0,
1,
0
],
"autoWrapText": true
},
"style": {
"padding": 1
}
}
],
"indicatorsAsCol": false,
"records": [
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"col_fld_tmp_zb_3": "7475",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "公司",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "7475"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"col_fld_tmp_zb_3": "1624",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "小型企业",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "1624"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"col_fld_tmp_zb_3": "1685",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "小型企业",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "1685"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"col_fld_tmp_zb_3": "12572",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "消费者",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "12572"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"col_fld_tmp_zb_3": "4406",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "消费者",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "4406"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"col_fld_tmp_zb_3": "4932",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "消费者",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "4932"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"col_fld_tmp_zb_3": "2783",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "公司",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "2783"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"col_fld_tmp_zb_3": "3024",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "公司",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "3024"
},
{
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"col_fld_tmp_zb_3": "4343",
"col_fld_tmp_zb_3_title": "计划发货天数",
"indicator_key_0": "计划发货天数",
"segmentation": "小型企业",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "4343"
},
{
"col_fld_tmp_zb_5": "6921",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "公司",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "6921"
},
{
"col_fld_tmp_zb_5": "1500",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "小型企业",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "1500"
},
{
"col_fld_tmp_zb_5": "1585",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "小型企业",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "1585"
},
{
"col_fld_tmp_zb_5": "4014",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "消费者",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "4014"
},
{
"col_fld_tmp_zb_5": "11473",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "消费者",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "11473"
},
{
"col_fld_tmp_zb_5": "4514",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "消费者",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "4514"
},
{
"col_fld_tmp_zb_5": "2772",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "家具",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "公司",
"series_field_01": "家具 ",
"category": "家具",
"indicator_val_0": "2772"
},
{
"col_fld_tmp_zb_5": "2589",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "技术",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "公司",
"series_field_01": "技术 ",
"category": "技术",
"indicator_val_0": "2589"
},
{
"col_fld_tmp_zb_5": "4062",
"indicator_title_0": "计划发货天数/实际发货天数",
"color_set_name": "办公用品",
"indicator_key_0": "实际发货天数",
"col_fld_tmp_zb_5_title": "实际发货天数",
"segmentation": "小型企业",
"series_field_01": "办公用品 ",
"category": "办公用品",
"indicator_val_0": "4062"
}
],
"autoWrapText": true,
"widthMode": "standard",
"heightMode": "standard",
"autoFillWidth": true,
"autoFillHeight": true,
};

  tableInstance =  new VTable.PivotChart(document.getElementById(CONTAINER_ID),option);
  window.tableInstance = tableInstance;
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed VTable.register.chartModule('vchart', VChart) setup and inspect how the chartSpec.series entries in the example are processed. Compare the two series configurations and trace where shared options are applied. The work is done when each series in a pivot combination chart can be configured independently, with behavior matching the proposed API.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.