You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/03/11 01:58:28 UTC
[echarts] 01/01: tweak(line): tweak #13013 & #13501. - only make
line bolder when there is more than one series and blur state - or the user
manually specify `lineStyle.width` as `bolder`
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch tweak-line-bolder
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 90d17c15f3c6fa2b3127611e99bcaecac4b8ada3
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Mar 11 09:50:50 2021 +0800
tweak(line): tweak #13013 & #13501.
- only make line bolder when there is more than one series and blur state
- or the user manually specify `lineStyle.width` as `bolder`
---
src/chart/line/LineSeries.ts | 5 +----
src/chart/line/LineView.ts | 27 +++++++++++++++++++++++----
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/chart/line/LineSeries.ts b/src/chart/line/LineSeries.ts
index f940873..0f7cb99 100644
--- a/src/chart/line/LineSeries.ts
+++ b/src/chart/line/LineSeries.ts
@@ -163,10 +163,7 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
},
emphasis: {
- scale: true,
- lineStyle: {
- width: 'bolder'
- }
+ scale: true
},
// areaStyle: {
// origin of areaStyle. Valid values:
diff --git a/src/chart/line/LineView.ts b/src/chart/line/LineView.ts
index 10b0b26..b92640a 100644
--- a/src/chart/line/LineView.ts
+++ b/src/chart/line/LineView.ts
@@ -736,10 +736,7 @@ class LineView extends ChartView {
setStatesStylesFromModel(polyline, seriesModel, 'lineStyle');
- if (polyline.style.lineWidth > 0 && seriesModel.get(['emphasis', 'lineStyle', 'width']) === 'bolder') {
- const emphasisLineStyle = polyline.getState('emphasis').style;
- emphasisLineStyle.lineWidth = polyline.style.lineWidth + 1;
- }
+ this._bolderLine(polyline, seriesModel, ecModel);
// Needs seriesIndex for focus
getECData(polyline).seriesIndex = seriesModel.seriesIndex;
@@ -1172,6 +1169,28 @@ class LineView extends ChartView {
}
/**
+ * To determine if the line should be bolder
+ *
+ * TODO:
+ * It's better to disable bolder when data is large,
+ * but it seems no simple way to figure out.
+ */
+ _bolderLine(polyline: ECPolyline, seriesModel: LineSeriesModel, ecModel: GlobalModel) {
+ if (polyline.style.lineWidth > 0) {
+ // only make line bolder when there is more than one series and blur state
+ // or the user manually specify `lineStyle.width` as `bolder`
+ // see https://github.com/apache/echarts/pull/13501
+ const emphasisLineWidth = seriesModel.get(['emphasis', 'lineStyle', 'width']);
+ if (emphasisLineWidth === 'bolder'
+ || (emphasisLineWidth == null && polyline.getState('blur') && ecModel.getSeriesCount() > 1)
+ ) {
+ const emphasisLineStyle = polyline.getState('emphasis').style;
+ emphasisLineStyle.lineWidth = polyline.style.lineWidth + 1;
+ }
+ }
+ }
+
+ /**
* @private
*/
// FIXME Two value axis
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org