Merge pull request #3564 from dataease/pr@dev@fix_table_wrong_index_number

Pr@dev@fix table wrong index number
This commit is contained in:
xuwei-fit2cloud 2022-10-31 22:17:41 +08:00 committed by GitHub
commit 12724a054a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 60 additions and 18 deletions

View File

@ -788,9 +788,7 @@ public class ChartViewService {
ChartExtFilterRequest drillFilter = new ChartExtFilterRequest();
drillFilter.setFieldId(dto.getId());
drillFilter.setValue(new ArrayList<String>() {{
add(dto.getValue());
}});
drillFilter.setValue(Collections.singletonList(dto.getValue()));
drillFilter.setOperator("in");
drillFilter.setDatasetTableField(datasetTableField);
extFilterList.add(drillFilter);

View File

@ -202,6 +202,10 @@ public class ChartDataBuild {
chartDimensionDTO.setValue(row[k]);
dimensionList.add(chartDimensionDTO);
}
ChartDimensionDTO chartDimensionDTO = new ChartDimensionDTO();
chartDimensionDTO.setId(extStack.get(0).getId());
chartDimensionDTO.setValue(row[xAxis.size()]);
dimensionList.add(chartDimensionDTO);
axisChartDataDTO.setDimensionList(dimensionList);
if (CollectionUtils.isNotEmpty(yAxis)) {
@ -1054,6 +1058,10 @@ public class ChartDataBuild {
chartDimensionDTO.setValue(row[j]);
dimensionList.add(chartDimensionDTO);
}
ChartDimensionDTO chartDimensionDTO = new ChartDimensionDTO();
chartDimensionDTO.setId(extStack.get(0).getId());
chartDimensionDTO.setValue(row[xAxis.size()]);
dimensionList.add(chartDimensionDTO);
axisChartDataDTO.setDimensionList(dimensionList);
if (CollectionUtils.isNotEmpty(yAxis)) {

View File

@ -1437,7 +1437,8 @@ export default {
reserve_two: '2',
proportion: 'Proportion',
label_content: 'Label Content',
percent: 'Percent'
percent: 'Percent',
table_index_desc: 'Index Header Name'
},
dataset: {
spend_time: 'Spend',

View File

@ -1437,7 +1437,8 @@ export default {
reserve_two: '两位',
proportion: '佔比',
label_content: '標籤展示',
percent: '占比'
percent: '占比',
table_index_desc: '表頭名稱'
},
dataset: {
spend_time: '耗時',

View File

@ -1436,7 +1436,8 @@ export default {
reserve_two: '两位',
proportion: '占比',
label_content: '标签展示',
percent: '占比'
percent: '占比',
table_index_desc: '表头名称'
},
dataset: {
spend_time: '耗时',

View File

@ -230,6 +230,9 @@ export function getLabel(chart) {
}
}
res = contentItems.join(' ')
} else if (equalsAny(chart.type, 'pie-rose', 'pie-donut-rose')) {
const quotaValue = valueFormatter(param.value, formatterCfg)
res = [param.field, quotaValue].join(' ')
} else {
res = valueFormatter(param.value, formatterCfg)
}

View File

@ -49,7 +49,7 @@ export function getCustomTheme(chart) {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign,
textBaseline: chart.type === 'table-pivot' ? 'top' : 'middle' // 行头字体绘制基线设置为中心,不然序号列的内容会靠上
textBaseline: chart.type === 'table-pivot' ? 'top' : 'middle'
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
@ -186,6 +186,7 @@ export function getCustomTheme(chart) {
theme.rowCell.measureText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.measureText.textAlign = i_a
}
theme.rowCell.seriesNumberWidth = parseInt(s.tableColumnWidth)
theme.colCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.bolderText.textAlign = h_a

View File

@ -1,9 +1,9 @@
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { TableSheet, S2Event, PivotSheet, DataCell } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
import { hexColorToRGBA } from '@/views/chart/chart/util'
export function baseTableInfo(s2, container, chart, action, tableData) {
export function baseTableInfo(s2, container, chart, action, tableData, pageInfo) {
const containerDom = document.getElementById(container)
// fields
@ -130,9 +130,19 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node) => {
if (node.colIndex === 0) {
node.label = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
node.label = ' '
} else {
node.label = customAttr.size.indexLabel
}
}
}
s2Options.dataCell = (viewMeta) => {
if (viewMeta.colIndex === 0) {
viewMeta.fieldValue = (pageInfo.pageSize * (pageInfo.page - 1)) + viewMeta.rowIndex + 1
}
return new DataCell(viewMeta, viewMeta?.spreadsheet)
}
}
// 开始渲染
@ -266,7 +276,11 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node) => {
if (node.colIndex === 0) {
node.label = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
node.label = ' '
} else {
node.label = customAttr.size.indexLabel
}
}
}
}

View File

@ -250,7 +250,7 @@ export default {
}
}
if (chart.type === 'table-info') {
this.myChart = baseTableInfo(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
this.myChart = baseTableInfo(this.myChart, this.chartId, chart, this.antVAction, this.tableData, this.currentPage)
} else if (chart.type === 'table-normal') {
this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-pivot') {

View File

@ -387,6 +387,7 @@
<el-form-item
v-show="showProperty('tableIndexLabel') && sizeForm.showIndex"
label-width="100px"
:label="$t('chart.table_index_desc')"
class="form-item"
>
<el-input
@ -1061,7 +1062,9 @@ export default {
this.sizeForm.tablePageSize = this.sizeForm.tablePageSize ? this.sizeForm.tablePageSize : DEFAULT_SIZE.tablePageSize
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
this.sizeForm.indexLabel = this.sizeForm.indexLabel ? this.sizeForm.indexLabel : DEFAULT_SIZE.indexLabel
if (this.sizeForm.indexLabel === null || this.sizeForm.indexLabel === undefined) {
this.sizeForm.indexLabel = DEFAULT_SIZE.indexLabel
}
this.sizeForm.quotaFontFamily = this.sizeForm.quotaFontFamily ? this.sizeForm.quotaFontFamily : DEFAULT_SIZE.quotaFontFamily
this.sizeForm.quotaFontIsBolder = this.sizeForm.quotaFontIsBolder ? this.sizeForm.quotaFontIsBolder : DEFAULT_SIZE.quotaFontIsBolder

View File

@ -376,6 +376,7 @@
<el-form-item
v-show="showProperty('tableIndexLabel') && sizeForm.showIndex"
label-width="100px"
:label="$t('chart.table_index_desc')"
class="form-item"
>
<el-input
@ -1355,7 +1356,9 @@ export default {
this.sizeForm.tableItemAlign = this.sizeForm.tableItemAlign ? this.sizeForm.tableItemAlign : DEFAULT_SIZE.tableItemAlign
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
this.sizeForm.indexLabel = this.sizeForm.indexLabel ? this.sizeForm.indexLabel : DEFAULT_SIZE.indexLabel
if (this.sizeForm.indexLabel === null || this.sizeForm.indexLabel === undefined) {
this.sizeForm.indexLabel = DEFAULT_SIZE.indexLabel
}
this.sizeForm.gaugeTickCount = this.sizeForm.gaugeTickCount ? this.sizeForm.gaugeTickCount : DEFAULT_SIZE.gaugeTickCount

View File

@ -23,6 +23,7 @@
:class="chart.id"
:show-summary="showSummary"
:summary-method="summaryMethod"
:index-config="{seqMethod}"
>
<ux-table-column
type="index"
@ -294,7 +295,11 @@ export default {
break
}
}
this.indexLabel = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
this.indexLabel = ' '
} else {
this.indexLabel = customAttr.size.indexLabel
}
}
this.table_item_class_stripe = JSON.parse(JSON.stringify(this.table_item_class))
//
@ -380,7 +385,11 @@ export default {
// ()
return [means]
},
seqMethod({ rowIndex, column }) {
if (column?.type === 'index') {
return (this.currentPage.pageSize * (this.currentPage.page - 1)) + rowIndex + 1
}
},
chartResize() {
//
this.calcHeightDelay()

View File

@ -1043,7 +1043,7 @@ export default {
attr.label.position = 'outer'
}
if (type === 'pie-donut') {
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.7)
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.75)
}
if (type === 'pie-donut-rose') {
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.5)

View File

@ -3092,7 +3092,7 @@ export default {
customAttr.label.position = 'outer'
}
if (type === 'pie-donut') {
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.7)
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.75)
}
if (type === 'pie-donut-rose') {
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.5)