You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2024/01/29 02:28:22 UTC

(echarts) branch revert-18921-fix/tooltip-color created (now 1b1284fff)

This is an automated email from the ASF dual-hosted git repository.

sulinghao pushed a change to branch revert-18921-fix/tooltip-color
in repository https://gitbox.apache.org/repos/asf/echarts.git


      at 1b1284fff Revert "fix(tooltip): fix opacity not work in tooltip marker"

This branch includes the following new commits:

     new 1b1284fff Revert "fix(tooltip): fix opacity not work in tooltip marker"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


(echarts) 01/01: Revert "fix(tooltip): fix opacity not work in tooltip marker"

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sulinghao pushed a commit to branch revert-18921-fix/tooltip-color
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 1b1284fff6e0282a195b9c154a3d6cd123cfc925
Author: Linghao Su <sl...@live.cn>
AuthorDate: Mon Jan 29 10:28:18 2024 +0800

    Revert "fix(tooltip): fix opacity not work in tooltip marker"
---
 src/component/tooltip/TooltipView.ts         |   2 +-
 src/component/tooltip/seriesFormatTooltip.ts |   5 +-
 src/component/tooltip/tooltipMarkup.ts       |  20 +---
 src/model/mixin/dataFormat.ts                |   2 -
 src/util/format.ts                           |   8 +-
 src/util/types.ts                            |   1 -
 test/runTest/actions/__meta__.json           |   1 -
 test/runTest/actions/tooltip-opacity.json    |   1 -
 test/tooltip-opacity.html                    | 144 ---------------------------
 9 files changed, 7 insertions(+), 177 deletions(-)

diff --git a/src/component/tooltip/TooltipView.ts b/src/component/tooltip/TooltipView.ts
index 461db0174..5600dc292 100644
--- a/src/component/tooltip/TooltipView.ts
+++ b/src/component/tooltip/TooltipView.ts
@@ -573,7 +573,7 @@ class TooltipView extends ComponentView {
                     // Pre-create marker style for makers. Users can assemble richText
                     // text in `formatter` callback and use those markers style.
                     cbParams.marker = markupStyleCreator.makeTooltipMarker(
-                        'item', convertToColorString(cbParams.color), renderMode, cbParams.opacity
+                        'item', convertToColorString(cbParams.color), renderMode
                     );
 
                     const seriesTooltipResult = normalizeTooltipFormatResult(
diff --git a/src/component/tooltip/seriesFormatTooltip.ts b/src/component/tooltip/seriesFormatTooltip.ts
index cdc3b7979..714cac2df 100644
--- a/src/component/tooltip/seriesFormatTooltip.ts
+++ b/src/component/tooltip/seriesFormatTooltip.ts
@@ -24,8 +24,7 @@ import {
     retrieveVisualColorForTooltipMarker,
     TooltipMarkupBlockFragment,
     createTooltipMarkup,
-    TooltipMarkupSection,
-    retrieveVisualOpacityForTooltipMarker
+    TooltipMarkupSection
 } from './tooltipMarkup';
 import { retrieveRawValue } from '../../data/helper/dataProvider';
 import { isNameSpecified } from '../../util/model';
@@ -48,7 +47,6 @@ export function defaultSeriesFormatTooltip(opt: {
     const value = series.getRawValue(dataIndex) as any;
     const isValueArr = isArray(value);
     const markerColor = retrieveVisualColorForTooltipMarker(series, dataIndex);
-    const markerOpacity = retrieveVisualOpacityForTooltipMarker(series, dataIndex);
 
     // Complicated rule for pretty tooltip.
     let inlineValue;
@@ -88,7 +86,6 @@ export function defaultSeriesFormatTooltip(opt: {
             createTooltipMarkup('nameValue', {
                 markerType: 'item',
                 markerColor: markerColor,
-                opacity: markerOpacity,
                 // Do not mix display seriesName and itemName in one tooltip,
                 // which might confuses users.
                 name: inlineName,
diff --git a/src/component/tooltip/tooltipMarkup.ts b/src/component/tooltip/tooltipMarkup.ts
index a277dad27..c416dad5d 100644
--- a/src/component/tooltip/tooltipMarkup.ts
+++ b/src/component/tooltip/tooltipMarkup.ts
@@ -149,7 +149,6 @@ export interface TooltipMarkupNameValueBlock extends TooltipMarkupBlock {
     // If `!markerType`, tooltip marker is not used.
     markerType?: TooltipMarkerType;
     markerColor?: ColorString;
-    opacity?: number;
     name?: string;
     // Also support value is `[121, 555, 94.2]`.
     value?: unknown | unknown[];
@@ -326,8 +325,7 @@ function buildNameValue(
         : ctx.markupStyleCreator.makeTooltipMarker(
             fragment.markerType,
             fragment.markerColor || '#333',
-            renderMode,
-            fragment.opacity
+            renderMode
         );
     const readableName = noName
         ? ''
@@ -478,16 +476,6 @@ export function retrieveVisualColorForTooltipMarker(
     return convertToColorString(color);
 }
 
-export function retrieveVisualOpacityForTooltipMarker(
-    series: SeriesModel,
-    dataIndex: number
-): number {
-    const style = series.getData().getItemVisual(dataIndex, 'style');
-    const opacity = style.opacity;
-    return opacity;
-}
-
-
 export function getPaddingFromTooltipModel(
     model: Model<TooltipOption>,
     renderMode: TooltipRenderMode
@@ -521,8 +509,7 @@ export class TooltipMarkupStyleCreator {
     makeTooltipMarker(
         markerType: TooltipMarkerType,
         colorStr: ColorString,
-        renderMode: TooltipRenderMode,
-        opacity?: number
+        renderMode: TooltipRenderMode
     ): string {
         const markerId = renderMode === 'richText'
             ? this._generateStyleName()
@@ -531,8 +518,7 @@ export class TooltipMarkupStyleCreator {
             color: colorStr,
             type: markerType,
             renderMode,
-            markerId: markerId,
-            opacity: opacity
+            markerId: markerId
         });
         if (isString(marker)) {
             return marker;
diff --git a/src/model/mixin/dataFormat.ts b/src/model/mixin/dataFormat.ts
index 99ca5607e..2c3981623 100644
--- a/src/model/mixin/dataFormat.ts
+++ b/src/model/mixin/dataFormat.ts
@@ -67,7 +67,6 @@ export class DataFormatMixin {
         const itemOpt = data.getRawDataItem(dataIndex);
         const style = data.getItemVisual(dataIndex, 'style');
         const color = style && style[data.getItemVisual(dataIndex, 'drawType') || 'fill'] as ZRColor;
-        const opacity = style && style.opacity;
         const borderColor = style && style.stroke as ColorString;
         const mainType = this.mainType;
         const isSeries = mainType === 'series';
@@ -88,7 +87,6 @@ export class DataFormatMixin {
             value: rawValue,
             color: color,
             borderColor: borderColor,
-            opacity: opacity,
             dimensionNames: userOutput ? userOutput.fullDimensions : null,
             encode: userOutput ? userOutput.encode : null,
 
diff --git a/src/util/format.ts b/src/util/format.ts
index 69f4be7a1..afe9625b4 100644
--- a/src/util/format.ts
+++ b/src/util/format.ts
@@ -181,7 +181,6 @@ interface GetTooltipMarkerOpt {
     // id name for marker. If only one marker is in a rich text, this can be omitted.
     // By default: 'markerX'
     markerId?: string;
-    opacity?: number;
 }
 // Only support color string
 export function getTooltipMarker(color: ColorString, extraCssText?: string): TooltipMarker;
@@ -192,7 +191,6 @@ export function getTooltipMarker(inOpt: ColorString | GetTooltipMarkerOpt, extra
         extraCssText: extraCssText
     } : (inOpt || {}) as GetTooltipMarkerOpt;
     const color = opt.color;
-    const opacity = String(opt.opacity || 1);
     const type = opt.type;
     extraCssText = opt.extraCssText;
     const renderMode = opt.renderMode || 'html';
@@ -206,10 +204,10 @@ export function getTooltipMarker(inOpt: ColorString | GetTooltipMarkerOpt, extra
         ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;'
             + 'border-radius:4px;width:4px;height:4px;background-color:'
             // Only support string
-            + encodeHTML(color) + ';' + 'opacity:' + encodeHTML(opacity) + ';' + (extraCssText || '') + '"></span>'
+            + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>'
         : '<span style="display:inline-block;margin-right:4px;'
             + 'border-radius:10px;width:10px;height:10px;background-color:'
-            + encodeHTML(color) + ';' + 'opacity:' + encodeHTML(opacity) + ';' + (extraCssText || '') + '"></span>';
+            + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>';
     }
     else {
         // Should better not to auto generate style name by auto-increment number here.
@@ -225,14 +223,12 @@ export function getTooltipMarker(inOpt: ColorString | GetTooltipMarkerOpt, extra
                     width: 4,
                     height: 4,
                     borderRadius: 2,
-                    opacity: opacity,
                     backgroundColor: color
                 }
                 : {
                     width: 10,
                     height: 10,
                     borderRadius: 5,
-                    opacity: opacity,
                     backgroundColor: color
                 }
         };
diff --git a/src/util/types.ts b/src/util/types.ts
index b7c74abf5..01e932188 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -696,7 +696,6 @@ export interface CallbackDataParams {
     dataType?: SeriesDataType;
     value: OptionDataItem | OptionDataValue;
     color?: ZRColor;
-    opacity?: number;
     borderColor?: string;
     dimensionNames?: DimensionName[];
     encode?: DimensionUserOuputEncode;
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index 8592bb1be..7b2ccc514 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -201,7 +201,6 @@
   "tooltip-domnode": 1,
   "tooltip-event": 1,
   "tooltip-link": 2,
-  "tooltip-opacity": 1,
   "tooltip-rich": 1,
   "tooltip-setOption": 2,
   "tooltip-valueFormatter": 3,
diff --git a/test/runTest/actions/tooltip-opacity.json b/test/runTest/actions/tooltip-opacity.json
deleted file mode 100644
index c10d9722a..000000000
--- a/test/runTest/actions/tooltip-opacity.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"name":"Action 1","ops":[{"type":"mousemove","time":1108,"x":1,"y":273},{"type":"mousemove","time":1308,"x":282,"y":375},{"type":"mousemove","time":1519,"x":283,"y":376},{"type":"screenshot","time":2038},{"type":"mousemove","time":2925,"x":283,"y":375},{"type":"mousemove","time":3126,"x":440,"y":322},{"type":"mousemove","time":3333,"x":453,"y":324},{"type":"screenshot","time":3945},{"type":"mousemove","time":4393,"x":453,"y":324},{"type":"mousemove","time":4595,"x":493,"y":508},{"type" [...]
\ No newline at end of file
diff --git a/test/tooltip-opacity.html b/test/tooltip-opacity.html
deleted file mode 100644
index 03820d4fb..000000000
--- a/test/tooltip-opacity.html
+++ /dev/null
@@ -1,144 +0,0 @@
-<!DOCTYPE html>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-
-<html>
-
-<head>
-    <meta charset="utf-8">
-    <script src="lib/simpleRequire.js"></script>
-    <script src="lib/config.js"></script>
-    <script src="lib/jquery.min.js"></script>
-    <script src="lib/facePrint.js"></script>
-    <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <link rel="stylesheet" href="lib/reset.css">
-    <script src="lib/testHelper.js"></script>
-    <script src="tooltipTestHelper.js"></script>
-</head>
-
-<body>
-    <style>
-        h1 {
-            line-height: 60px;
-            height: 60px;
-            background: #140;
-            text-align: center;
-            font-weight: bold;
-            color: #eee;
-            font-size: 14px;
-        }
-
-        .chart {
-            height: 850px;
-        }
-    </style>
-
-    <h1>axisPointer link in one echarts instance | after data zoom, link should be normal</h1>
-    <div class="chart" id="candlestick"></div>
-
-    <script>
-
-        require([
-            'echarts'
-        ], function (echarts) {
-
-            var dom = document.getElementById('candlestick');
-            if (!dom) {
-                return;
-            }
-
-            var chart = echarts.init(dom);
-
-            var option = {
-                dataset: {
-                    source: [
-                        {
-                            category: "Category 1",
-                            revenueGross: 123,
-                            revenueGrossPrevious: 153,
-                            revenueNet: 98,
-                            revenueNetPrevious: 124,
-                        },
-                        {
-                            category: "Category 2",
-                            revenueGross: 235,
-                            revenueGrossPrevious: 143,
-                            revenueNet: 201,
-                            revenueNetPrevious: 102,
-                        }
-                    ],
-                },
-                series: [
-                    {
-                        type: "bar",
-                        dimensions: ["category", "revenueGross"],
-                        name: "Revenue gross"
-                    },
-                    {
-                        type: "bar",
-                        dimensions: ["category", "revenueGrossPrevious"],
-                        name: "Revenue gross: previous",
-                        itemStyle: {
-                            color: "#5470c6",
-                            opacity: 0.5,
-                        }
-                    },
-                    {
-                        type: "bar",
-                        dimensions: ["category", "revenueNet"],
-                        name: "Revenue net",
-                    },
-                    {
-                        type: "bar",
-                        dimensions: ["category", "revenueNetPrevious"],
-                        name: "Revenue net: previous",
-                        itemStyle: {
-                            color: "#91cc75",
-                            opacity: 0.5,
-                        }
-                    },
-                ],
-                xAxis: {
-                    type: "category",
-                    id: "category",
-                },
-                yAxis: [
-                    {
-                        type: "value",
-                        name: "Revenue",
-                    },
-                ],
-                legend: {},
-                tooltip: {
-                    trigger: "axis",
-                    axisPointer: {
-                        type: "shadow",
-                    },
-                    enterable: true,
-                }
-            };
-
-            chart.setOption(option);
-        });
-
-    </script>
-</body>
-
-</html>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org