1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

scale plot tick count to width

This commit is contained in:
Ricardo Hernandez-Montoya 2017-04-05 11:32:02 +02:00
parent 119b651b11
commit 42cee87ef1

View file

@ -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 (
<div className="plot-table-widget" ref="wrapper">
<h4>{this.props.widget.name}</h4>
@ -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] }}