未验证 提交 057c43c5 编写于 作者: M Maxime Beauchemin 提交者: GitHub

Revert "Truncate long labels (#6631)" (#6723)

This reverts commit 5055157b.
上级 ef797579
......@@ -44,7 +44,6 @@ import {
tryNumify,
setAxisShowMaxMin,
stringifyTimeRange,
truncateLabel,
wrapTooltip,
} from './utils';
import {
......@@ -627,8 +626,6 @@ function nvd3Vis(element, props) {
if (chart.xAxis) {
margins.bottom = 28;
}
// truncate labels that are too long
d3.selectAll('.nv-x.nv-axis .tick text').text(truncateLabel);
const maxYAxisLabelWidth = getMaxLabelSize(svg, chart.yAxis2 ? 'nv-y1' : 'nv-y');
const maxXAxisLabelHeight = getMaxLabelSize(svg, 'nv-x');
margins.left = maxYAxisLabelWidth + marginPad;
......@@ -714,9 +711,6 @@ function nvd3Vis(element, props) {
.attr('height', height)
.call(chart);
// truncate labels that are too long
d3.selectAll('.nv-x.nv-axis .tick text').text(truncateLabel);
// on scroll, hide tooltips. throttle to only 4x/second.
window.addEventListener('scroll', throttle(hideTooltips, 250));
......
......@@ -22,8 +22,6 @@ import dompurify from 'dompurify';
import { getNumberFormatter } from '@superset-ui/number-format';
import { smartDateFormatter } from '@superset-ui/time-format';
const MAX_LABEL_LENGTH = 24;
// Regexp for the label added to time shifted series
// (1 hour offset, 2 days offset, etc.)
const TIME_SHIFT_PATTERN = /\d+ \w+ offset/;
......@@ -257,9 +255,3 @@ export function setAxisShowMaxMin(axis, showminmax) {
axis.showMaxMin(showminmax);
}
}
export function truncateLabel(text) {
return text.length > MAX_LABEL_LENGTH
? text.substr(0, MAX_LABEL_LENGTH - 1) + ''
: text;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册