You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2021/09/24 05:58:42 UTC

[echarts] branch fix-aria created (now 04b2d1d)

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

ovilia pushed a change to branch fix-aria
in repository https://gitbox.apache.org/repos/asf/echarts.git.


      at 04b2d1d  fix(aria): fix aria label with dataset #15734

This branch includes the following new commits:

     new 04b2d1d  fix(aria): fix aria label with dataset #15734

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: fix(aria): fix aria label with dataset #15734

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

ovilia pushed a commit to branch fix-aria
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 04b2d1d2492ae3476ac2cfdafcad3cfd6ad6c0e7
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Sep 24 13:57:07 2021 +0800

    fix(aria): fix aria label with dataset #15734
---
 src/visual/aria.ts |  8 ++++----
 test/aria-pie.html | 26 ++++++++++++++++++++++----
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/visual/aria.ts b/src/visual/aria.ts
index 9d2afa6..9208248 100644
--- a/src/visual/aria.ts
+++ b/src/visual/aria.ts
@@ -210,22 +210,22 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
                         seriesLabel += labelModel.get(['data', 'allData']);
                     }
 
+                    const middleSeparator = labelModel.get(['data', 'separator', 'middle']);
+                    const endSeparator = labelModel.get(['data', 'separator', 'end']);
                     const dataLabels = [];
                     for (let i = 0; i < data.count(); i++) {
                         if (i < maxDataCnt) {
                             const name = data.getName(i);
-                            const value = retrieveRawValue(data, i);
+                            const value = data.getValues(i);
                             const dataLabel = labelModel.get(['data', name ? 'withName' : 'withoutName']);
                             dataLabels.push(
                                 replace(dataLabel, {
                                     name: name,
-                                    value: value
+                                    value: value.join(middleSeparator)
                                 })
                             );
                         }
                     }
-                    const middleSeparator = labelModel.get(['data', 'separator', 'middle']);
-                    const endSeparator = labelModel.get(['data', 'separator', 'end']);
                     seriesLabel += dataLabels.join(middleSeparator) + endSeparator;
 
                     seriesLabels.push(seriesLabel);
diff --git a/test/aria-pie.html b/test/aria-pie.html
index ec4fa32..789724d 100644
--- a/test/aria-pie.html
+++ b/test/aria-pie.html
@@ -45,6 +45,10 @@ under the License.
         </style>
 
         <div id="main" class="chart"></div>
+        <p id="aria-1"></p>
+
+        <div id="main2" class="chart"></div>
+        <p id="aria-2"></p>
         <script>
 
         require(['echarts'],
@@ -95,11 +99,25 @@ under the License.
                     ]
                 });
 
-                chart.on('pieselectchanged', function (e) {
-                    console.log(e);
-                });
+                document.getElementById('aria-1').innerText = chart.getDom().getAttribute('aria-label');
+
+                var chart2 = echarts.init(document.getElementById('main2'));
 
-                window.onresize = chart.resize;
+                chart2.setOption(
+                    {
+                        "dataset": {
+                            "dimensions": ["c_0", "c_1"],
+                            "source": [{"c_0": "Amount used", "c_1": 1699.0}, {"c_0": "Amount left", "c_1": 2301.0}]
+                        },
+                        "series": [{
+                            "type": "pie", "silent": true,
+                            "encode": {"itemName": "c_0", "value": "c_1"},
+                            "radius": ["30%", "60%"]
+                        }],
+                        "aria": {"show": true}
+                    }
+                );
+                document.getElementById('aria-2').innerText = chart2.getDom().getAttribute('aria-label');
             }
         );
         </script>

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