@easyv/charts 1.3.36 → 1.3.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/hooks/useAxes.js +4 -3
- package/package.json +1 -1
- package/src/hooks/useAxes.js +5 -7
package/lib/hooks/useAxes.js
CHANGED
|
@@ -110,13 +110,13 @@ var _default = function _default(_ref) {
|
|
|
110
110
|
var range = direction === 'horizontal' ? [start, end] : direction === 'vertical' ? [end, start] : [0, 0];
|
|
111
111
|
var newDomain = domain;
|
|
112
112
|
|
|
113
|
-
if (
|
|
113
|
+
if (type !== 'ordinal' && !isNaN(domain[1])) {
|
|
114
114
|
newDomain = getNewDomain(domain, mode, step);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
var scaler = scales[type]().domain(newDomain).range(range);
|
|
118
118
|
scaler.type = type;
|
|
119
|
-
if (type !== 'ordinal') scaler.
|
|
119
|
+
if (type !== 'ordinal') scaler.clamp(true);
|
|
120
120
|
var allTicks = ticks ? ticks : scaler.ticks ? scaler.ticks(tickCount) : scaler.domain();
|
|
121
121
|
var _ticks = allTicks;
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ var _default = function _default(_ref) {
|
|
|
128
128
|
if (auto === false) {
|
|
129
129
|
switch (mode) {
|
|
130
130
|
case 'count':
|
|
131
|
-
_ticks = (0, _utils2.getYTicks)(
|
|
131
|
+
_ticks = (0, _utils2.getYTicks)(newDomain[1], newDomain[0], +tickCount);
|
|
132
132
|
break;
|
|
133
133
|
|
|
134
134
|
case 'step':
|
|
@@ -138,6 +138,7 @@ var _default = function _default(_ref) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
console.log(newDomain, _ticks, allTicks);
|
|
141
142
|
var lengthWithoutPaddingOuter = length - _paddingOuter;
|
|
142
143
|
|
|
143
144
|
if (type == 'linear' && config.on) {
|
package/package.json
CHANGED
package/src/hooks/useAxes.js
CHANGED
|
@@ -20,7 +20,6 @@ const getNewDomain=(domain, mode, step)=>{
|
|
|
20
20
|
let newDomain=[];
|
|
21
21
|
let min = domain[0], max = domain[1];
|
|
22
22
|
let minCount = Math.pow(10,getCount(min)), maxCount = Math.pow(10,getCount(max));
|
|
23
|
-
|
|
24
23
|
switch(mode){
|
|
25
24
|
case 'count':
|
|
26
25
|
newDomain[0] = Math.floor(domain[0]/minCount)*minCount;
|
|
@@ -71,14 +70,13 @@ export default ({ axes, context: { width, height } }) => {
|
|
|
71
70
|
carousel,
|
|
72
71
|
config,
|
|
73
72
|
} = item;
|
|
74
|
-
|
|
73
|
+
|
|
75
74
|
const direction =
|
|
76
75
|
orientation === 'top' || orientation === 'bottom'
|
|
77
76
|
? 'horizontal'
|
|
78
77
|
: orientation === 'left' || orientation === 'right'
|
|
79
78
|
? 'vertical'
|
|
80
79
|
: '';
|
|
81
|
-
|
|
82
80
|
const length =
|
|
83
81
|
direction === 'horizontal'
|
|
84
82
|
? width
|
|
@@ -97,13 +95,13 @@ export default ({ axes, context: { width, height } }) => {
|
|
|
97
95
|
? [end, start]
|
|
98
96
|
: [0, 0];
|
|
99
97
|
let newDomain = domain;
|
|
100
|
-
if(
|
|
98
|
+
if(type !== 'ordinal' && !isNaN(domain[1])){
|
|
101
99
|
newDomain = getNewDomain(domain, mode, step);
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
const scaler = scales[type]().domain(newDomain).range(range);
|
|
105
103
|
scaler.type = type;
|
|
106
|
-
if (type !== 'ordinal') scaler.nice().clamp(true)
|
|
104
|
+
if (type !== 'ordinal') scaler.clamp(true); //scaler.nice().clamp(true)
|
|
107
105
|
const allTicks = ticks
|
|
108
106
|
? ticks
|
|
109
107
|
: scaler.ticks
|
|
@@ -119,8 +117,8 @@ export default ({ axes, context: { width, height } }) => {
|
|
|
119
117
|
switch (mode) {
|
|
120
118
|
case 'count':
|
|
121
119
|
_ticks = getYTicks(
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
newDomain[1],
|
|
121
|
+
newDomain[0],
|
|
124
122
|
+tickCount
|
|
125
123
|
);
|
|
126
124
|
break;
|