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 2022/11/08 06:03:39 UTC
[echarts] 01/01: style: fix code style flaw and remove unnecessary default parameter. (#17098)
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch fix/code-style-17098
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit b9a19ebf86ac2efc00a1259a83b069f6fb5e5619
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Tue Nov 8 13:58:11 2022 +0800
style: fix code style flaw and remove unnecessary default parameter. (#17098)
---
src/chart/bar/BaseBarSeries.ts | 6 +-
src/component/marker/MarkAreaView.ts | 2 +-
src/model/Series.ts | 3 +-
test/bar-markArea.html | 206 +++++++++++++++++------------------
4 files changed, 106 insertions(+), 111 deletions(-)
diff --git a/src/chart/bar/BaseBarSeries.ts b/src/chart/bar/BaseBarSeries.ts
index 162cf7214..47411cd39 100644
--- a/src/chart/bar/BaseBarSeries.ts
+++ b/src/chart/bar/BaseBarSeries.ts
@@ -86,7 +86,11 @@ class BaseBarSeriesModel<Opts extends BaseBarSeriesOption<unknown> = BaseBarSeri
return createSeriesData(null, this, {useEncodeDefaulter: true});
}
- getMarkerPosition(value: ScaleDataValue[], dims?: typeof dimPermutations[number], startingAtTick: boolean = false) {
+ getMarkerPosition(
+ value: ScaleDataValue[],
+ dims?: typeof dimPermutations[number],
+ startingAtTick?: boolean
+ ) {
const coordSys = this.coordinateSystem;
if (coordSys && coordSys.clampData) {
// PENDING if clamp ?
diff --git a/src/component/marker/MarkAreaView.ts b/src/component/marker/MarkAreaView.ts
index 9b2476d36..8f9961077 100644
--- a/src/component/marker/MarkAreaView.ts
+++ b/src/component/marker/MarkAreaView.ts
@@ -183,7 +183,7 @@ function getSingleMarkerEndPoint(
else {
pointValue[1] = (clampPointValue0[1] > clampPointValue1[1]) ? pointValue0[1] : pointValue1[1];
}
- // Use the getMarkerPoisition
+ // Use the getMarkerPosition
point = seriesModel.getMarkerPosition(
pointValue, dims, true
);
diff --git a/src/model/Series.ts b/src/model/Series.ts
index 5a9dd6260..e2a5577b9 100644
--- a/src/model/Series.ts
+++ b/src/model/Series.ts
@@ -103,7 +103,8 @@ interface SeriesModel {
getMarkerPosition(
value: ScaleDataValue[],
dims?: typeof dimPermutations[number],
- startingAtTick?:boolean): number[];
+ startingAtTick?: boolean
+ ): number[];
/**
* Get legend icon symbol according to each series type
diff --git a/test/bar-markArea.html b/test/bar-markArea.html
index 81de2f543..5a4acd722 100644
--- a/test/bar-markArea.html
+++ b/test/bar-markArea.html
@@ -25,7 +25,6 @@ under the License.
<meta name="viewport" content="width=device-width, initial-scale=1" />
<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>
<script src="lib/testHelper.js"></script>
<!-- <script src="ut/lib/canteen.js"></script> -->
@@ -43,137 +42,128 @@ under the License.
<script>
require([
- 'echarts',
- // 'map/js/china',
- // './data/nutrients.json'
+ 'echarts'
], function (echarts) {
var option;
- option = {
- xAxis: {
- type: 'category',
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- data: [120, 200, 150, 80, 70, 110, 130],
- type: 'bar',
- markArea: {
- data: [
- [
- {
- name: 'Invert input',
- xAxis: 'Thu'
- },
- {
- xAxis: 'Mon'
- }
- ]
- ]
- }
- },
- {
- data: [120, 200, 150, 80, 70, 110, 130],
- type: 'bar',
- markArea: {
- data: [
- [
- {
- name: 'Single Emphasis',
- xAxis: 'Sun'
- },
- {
- xAxis: 'Sun'
- }
- ]
- ]
- }
- }
- ]
- };
+ option = {
+ xAxis: {
+ type: 'category',
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+ },
+ yAxis: {
+ type: 'value'
+ },
+ series: [
+ {
+ data: [120, 200, 150, 80, 70, 110, 130],
+ type: 'bar',
+ markArea: {
+ data: [
+ [
+ {
+ name: 'Invert input',
+ xAxis: 'Thu'
+ },
+ {
+ xAxis: 'Mon'
+ }
+ ]
+ ]
+ }
+ },
+ {
+ data: [120, 200, 150, 80, 70, 110, 130],
+ type: 'bar',
+ markArea: {
+ data: [
+ [
+ {
+ name: 'Single Emphasis',
+ xAxis: 'Sun'
+ },
+ {
+ xAxis: 'Sun'
+ }
+ ]
+ ]
+ }
+ }
+ ]
+ };
+
var chart = testHelper.create(echarts, 'main0', {
title: [
- `MarkArea should be covering the 'Mon' to 'Thu' area and 'Sun' area`,
+ `MarkArea should cover the **'Mon'** to **'Thu'** area and **'Sun'** area`,
`rather than area between bars inside. (See issue#12341)`
],
option: option
- // height: 300,
- // buttons: [{text: 'btn-txt', onclick: function () {}}],
- // recordCanvas: true,
});
});
</script>
<script>
require([
- 'echarts',
- // 'map/js/china',
- // './data/nutrients.json'
+ 'echarts'
], function (echarts) {
var option;
- option = {
- xAxis: {
- type: 'category',
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
- },
- yAxis: {
- type: 'category',
- data: ['Sleep', 'Exercise', 'Gardening', 'Gaming', 'Work']
- },
- series: [
- {
- data: ['Work', 'Exercise', 'Work', 'Gardening', 'Gaming' ],
- type: 'bar',
- markArea: {
- data: [
- [
- {
- name: 'Dual Axes specified Emphasis',
- xAxis: 'Fri',
- yAxis: 'Work'
- },
- {
- xAxis: 'Mon',
- yAxis: 'Gardening'
- }
- ]
- ]
- }
- },
- {
- data: ['Gardening', 'Work', 'Exercise', 'Exercise', 'Gardening'],
- type: 'bar',
- markArea: {
- data: [
- [
- {
- name: 'Coord specified Emphasis',
- coord:['Mon', 'Exercise']
- },
- {
- coord:['Tue', 'Gardening']
- }
- ]
- ]
- }
- }
- ]
- };
+ option = {
+ xAxis: {
+ type: 'category',
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+ },
+ yAxis: {
+ type: 'category',
+ data: ['Sleep', 'Exercise', 'Gardening', 'Gaming', 'Work']
+ },
+ series: [
+ {
+ data: ['Work', 'Exercise', 'Work', 'Gardening', 'Gaming'],
+ type: 'bar',
+ markArea: {
+ data: [
+ [
+ {
+ name: 'Dual Axes specified Emphasis',
+ xAxis: 'Fri',
+ yAxis: 'Work'
+ },
+ {
+ xAxis: 'Mon',
+ yAxis: 'Gardening'
+ }
+ ]
+ ]
+ }
+ },
+ {
+ data: ['Gardening', 'Work', 'Exercise', 'Exercise', 'Gardening'],
+ type: 'bar',
+ markArea: {
+ data: [
+ [
+ {
+ name: 'Coord specified Emphasis',
+ coord: ['Mon', 'Exercise']
+ },
+ {
+ coord: ['Tue', 'Gardening']
+ }
+ ]
+ ]
+ }
+ }
+ ]
+ };
var chart = testHelper.create(echarts, 'main1', {
title: [
- `MarkArea should be covering the 'Mon' to 'Fri' area and 'Exercise' to 'Gaming' area`,
+ `MarkArea should cover the **'Mon'** to **'Fri'** area and **'Exercise'** to **'Gaming'** area`,
`rather than area between bars inside. (Dual category axes for bar chart is rare)`
],
option: option
- // height: 300,
- // buttons: [{text: 'btn-txt', onclick: function () {}}],
- // recordCanvas: true,
});
});
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org