From 42cee87ef16ce645e2efd5b9ba216c0d023fbe15 Mon Sep 17 00:00:00 2001 From: Ricardo Hernandez-Montoya Date: Wed, 5 Apr 2017 11:32:02 +0200 Subject: [PATCH] scale plot tick count to width --- src/components/widget-plot-table.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/widget-plot-table.js b/src/components/widget-plot-table.js index 9c5154b..7f084c6 100644 --- a/src/components/widget-plot-table.js +++ b/src/components/widget-plot-table.js @@ -128,6 +128,9 @@ class WidgetPlotTable extends Component { }, []); } + // Make tick count proportional to the plot width using a rough scale ratio + var tickCount = Math.round(this.state.size.w / 80); + return (

{this.props.widget.name}

@@ -151,6 +154,7 @@ class WidgetPlotTable extends Component { colors={ scaleOrdinal(schemeCategory10) } gridHorizontal={true} xAccessor={(d) => { if (d != null) { return new Date(d.x); } }} + xAxisTickCount={ tickCount } hoverAnimation={false} circleRadius={0} domain={{ x: [this.state.firstTimestamp, this.state.latestTimestamp] }}