浏览代码

Show same number of ticks as data points

sbkwgh 8 年之前
父节点
当前提交
16eb4faf00
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      src/components/widgets/PageViews.vue

+ 3 - 5
src/components/widgets/PageViews.vue

@@ -107,8 +107,9 @@
 			updateFuncs () {
 				this.setXFunc()
 				this.setYFunc()
-
-				d3.select(this.$refs.x_axis).call(d3.axisBottom(this.x).tickSize(0))
+			
+				d3.select(this.$refs.y_axis).call(d3.axisLeft(this.y.nice()))
+				d3.select(this.$refs.x_axis).call(d3.axisBottom(this.x).tickSize(0).ticks(this.data.length))
 			},
 			showTooltip (e, i) {
 				this.tooltipShow = true
@@ -143,9 +144,6 @@
 				this.updateFuncs()
 			}, 200)
 			window.addEventListener('resize', resizeCb)
-
-			d3.select(this.$refs.y_axis).call(d3.axisLeft(this.y.nice()))
-			d3.select(this.$refs.x_axis).call(d3.axisBottom(this.x).tickSize(0))
 		}
 	}
 </script>