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 2019/11/07 10:27:13 UTC
[incubator-echarts] branch fix/axis-interval20 created (now c823297)
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a change to branch fix/axis-interval20
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.
at c823297 fix: fix the tick does not align with splitArea and axisPointer. The bug is brought by the fix of <https://github.com/apache/incubator-echarts/commit/c34274a6e30ec6da933139f7c93952f424f02d6c#diff-55a4b65a0a0b6e78888cfaf9b42973f8L318>.
This branch includes the following new commits:
new c823297 fix: fix the tick does not align with splitArea and axisPointer. The bug is brought by the fix of <https://github.com/apache/incubator-echarts/commit/c34274a6e30ec6da933139f7c93952f424f02d6c#diff-55a4b65a0a0b6e78888cfaf9b42973f8L318>.
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
[incubator-echarts] 01/01: fix: fix the tick does not align with
splitArea and axisPointer. The bug is brought by the fix of
.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/axis-interval20
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit c82329711bfd73742274d5e19f3725a64d3d635a
Author: SHUANG SU <su...@gmail.com>
AuthorDate: Thu Nov 7 18:26:06 2019 +0800
fix: fix the tick does not align with splitArea and axisPointer. The bug is brought by the fix of <https://github.com/apache/incubator-echarts/commit/c34274a6e30ec6da933139f7c93952f424f02d6c#diff-55a4b65a0a0b6e78888cfaf9b42973f8L318>.
---
src/coord/Axis.js | 6 ++--
test/axis-interval.html | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/src/coord/Axis.js b/src/coord/Axis.js
index 1af761a..ef5adac 100644
--- a/src/coord/Axis.js
+++ b/src/coord/Axis.js
@@ -199,7 +199,7 @@ Axis.prototype = {
var alignWithLabel = tickModel.get('alignWithLabel');
fixOnBandTicksCoords(
- this, ticksCoords, result.tickCategoryInterval, alignWithLabel, opt.clamp
+ this, ticksCoords, alignWithLabel, opt.clamp
);
return ticksCoords;
@@ -292,7 +292,7 @@ function fixExtentWithBands(extent, nTick) {
// splitLine/spliteArea should layout appropriately corresponding
// to displayed labels. (So we should not use `getBandWidth` in this
// case).
-function fixOnBandTicksCoords(axis, ticksCoords, tickCategoryInterval, alignWithLabel, clamp) {
+function fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {
var ticksLen = ticksCoords.length;
if (!axis.onBand || alignWithLabel || !ticksLen) {
@@ -312,7 +312,7 @@ function fixOnBandTicksCoords(axis, ticksCoords, tickCategoryInterval, alignWith
each(ticksCoords, function (ticksItem) {
ticksItem.coord -= shift / 2;
- tickCategoryInterval = tickCategoryInterval || 0;
+ var tickCategoryInterval = 0;
// Avoid split a single data item when odd interval.
if (tickCategoryInterval % 2 > 0) {
ticksItem.coord -= shift / ((tickCategoryInterval + 1) * 2);
diff --git a/test/axis-interval.html b/test/axis-interval.html
index eae7abc..f9c5664 100644
--- a/test/axis-interval.html
+++ b/test/axis-interval.html
@@ -68,6 +68,7 @@ under the License.
<div class="chart" id="main4"></div>
</div>
+ <div class="chart" id="main5"></div>
<script>
@@ -462,6 +463,79 @@ under the License.
</script>
+
+
+ <script>
+ require([
+ 'echarts'
+ ], function (echarts) {
+
+ var xAxisData = [
+ 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra',
+ 'Scorpio', 'Sagittarius', 'Capricornus', 'Aquarius', 'Pisces'
+ ];
+ var data0 = [];
+ var data1 = [];
+ var data2 = [];
+ var data3 = [];
+
+ for (var i = 0; i < xAxisData.length; i++) {
+ data0.push([Math.random() * 100, Math.random() * 30]);
+ data1.push(Math.random() * 30);
+ data2.push([Math.random() * (i % 2 === 0 ? 100 : 1000000), Math.random() * 30]);
+ data3.push([+new Date() + Math.round(Math.random() * 3600 * 24 * 30), Math.random() * 30]);
+ }
+
+ var height = '18%';
+
+ var option = {
+ tooltip: {
+ trigger: 'axis'
+ },
+ dataZoom: [{
+ type: 'inside'
+ }, {
+ type: 'slider'
+ }],
+ xAxis: [{
+ type: 'category',
+ data: xAxisData,
+ height: height,
+ axisTick: {
+ // alignWithLabel: true
+ },
+ // splitLine: {show: true},
+ axisPointer: {
+ type: 'shadow'
+ }
+ }],
+ yAxis: {
+ // splitLine: {show: false}
+ },
+ series: [{
+ type: 'scatter',
+ symbolSize: function (val) {
+ return val;
+ },
+ data: data1
+ }]
+ };
+
+ var chart = testHelper.create(echarts, 'main5', {
+ title: 'tick split should be correct',
+ option: option,
+ width: 800,
+ height: 240
+ // recordCanvas: true
+ });
+ });
+
+ </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