commit
883a558c4a
@ -1187,7 +1187,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
if (request.getDatasetTableField().getDeExtractType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(DorisConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
||||
@ -1250,8 +1250,15 @@ public class ChartViewService {
|
||||
// 同比/环比计算,通过对比类型和数据设置,计算出对应指标的结果,然后替换结果data数组中的对应元素
|
||||
// 如果因维度变化(如时间字段缺失,时间字段的展示格式变化)导致无法计算结果的,则结果data数组中的对应元素全置为null
|
||||
// 根据不同图表类型,获得需要替换的指标index array
|
||||
for (int i = 0; i < yAxis.size(); i++) {
|
||||
ChartViewFieldDTO chartViewFieldDTO = yAxis.get(i);
|
||||
List<ChartViewFieldDTO> tempYAxis = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(xAxis) && StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
//针对散点图scatter处理
|
||||
tempYAxis.add(xAxis.get(0));
|
||||
}
|
||||
tempYAxis.addAll(yAxis);
|
||||
|
||||
for (int i = 0; i < tempYAxis.size(); i++) {
|
||||
ChartViewFieldDTO chartViewFieldDTO = tempYAxis.get(i);
|
||||
ChartFieldCompareDTO compareCalc = chartViewFieldDTO.getCompareCalc();
|
||||
if (ObjectUtils.isEmpty(compareCalc)) {
|
||||
continue;
|
||||
|
||||
@ -329,7 +329,12 @@ public class ChartDataBuild {
|
||||
AxisChartDataAntVDTO axisChartDataDTO = new AxisChartDataAntVDTO();
|
||||
|
||||
if (xIsNumber) {
|
||||
axisChartDataDTO.setX(new BigDecimal(a.toString()));
|
||||
BigDecimal v = null;
|
||||
try {
|
||||
v = new BigDecimal(a.toString());
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
axisChartDataDTO.setX(v);
|
||||
} else {
|
||||
axisChartDataDTO.setX(a.toString());
|
||||
}
|
||||
|
||||
@ -158,8 +158,13 @@ export function getLabel(chart) {
|
||||
// label value formatter
|
||||
if (chart.type && chart.type !== 'waterfall') {
|
||||
label.formatter = function(param) {
|
||||
let yAxis, extStack, xaxisExt
|
||||
let xAxis, yAxis, extStack, xaxisExt
|
||||
let res = param.value
|
||||
try {
|
||||
xAxis = JSON.parse(chart.xaxis)
|
||||
} catch (e) {
|
||||
xAxis = JSON.parse(JSON.stringify(chart.xaxis))
|
||||
}
|
||||
try {
|
||||
yAxis = JSON.parse(chart.yaxis)
|
||||
} catch (e) {
|
||||
@ -244,38 +249,46 @@ export function getLabel(chart) {
|
||||
} else {
|
||||
for (let i = 0; i < yAxis.length; i++) {
|
||||
const f = yAxis[i]
|
||||
if (f.name === param.category) {
|
||||
let formatterCfg = formatterItem
|
||||
if (f.formatterCfg) {
|
||||
formatterCfg = f.formatterCfg
|
||||
}
|
||||
// 饼图和环形图格式优化
|
||||
if (equalsAny(chart.type, 'pie', 'pie-donut')) {
|
||||
// 这边默认值取指标是为了兼容存量的视图
|
||||
const labelContent = l.labelContent ?? ['quota']
|
||||
const contentItems = []
|
||||
if (labelContent.includes('dimension')) {
|
||||
contentItems.push(param.field)
|
||||
}
|
||||
if (labelContent.includes('quota')) {
|
||||
contentItems.push(valueFormatter(param.value, formatterCfg))
|
||||
}
|
||||
if (labelContent.includes('proportion')) {
|
||||
const percentage = `${(Math.round(param.percent * 10000) / 100).toFixed(l.reserveDecimalCount)}%`
|
||||
if (labelContent.length === 3) {
|
||||
contentItems.push(`(${percentage})`)
|
||||
} else {
|
||||
contentItems.push(percentage)
|
||||
}
|
||||
}
|
||||
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 {
|
||||
let formatterCfg = formatterItem
|
||||
if (f.formatterCfg) {
|
||||
formatterCfg = f.formatterCfg
|
||||
}
|
||||
|
||||
if (chart.type === 'scatter' && xAxis && xAxis.length > 0 && xAxis[0].groupType === 'q') {
|
||||
// 针对横轴为指标的散点图
|
||||
if (f.name === param.group) {
|
||||
res = valueFormatter(param.value, formatterCfg)
|
||||
}
|
||||
break
|
||||
} else {
|
||||
if (f.name === param.category) {
|
||||
// 饼图和环形图格式优化
|
||||
if (equalsAny(chart.type, 'pie', 'pie-donut')) {
|
||||
// 这边默认值取指标是为了兼容存量的视图
|
||||
const labelContent = l.labelContent ?? ['quota']
|
||||
const contentItems = []
|
||||
if (labelContent.includes('dimension')) {
|
||||
contentItems.push(param.field)
|
||||
}
|
||||
if (labelContent.includes('quota')) {
|
||||
contentItems.push(valueFormatter(param.value, formatterCfg))
|
||||
}
|
||||
if (labelContent.includes('proportion')) {
|
||||
const percentage = `${(Math.round(param.percent * 10000) / 100).toFixed(l.reserveDecimalCount)}%`
|
||||
if (labelContent.length === 3) {
|
||||
contentItems.push(`(${percentage})`)
|
||||
} else {
|
||||
contentItems.push(percentage)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user