mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
remove hidden ticks instead of toggling display. needs benchmark.
This commit is contained in:
parent
30749cf7af
commit
8a4c2a72f5
11
assets/src/js/components/Chart.js
vendored
11
assets/src/js/components/Chart.js
vendored
@ -149,6 +149,9 @@ class Chart extends Component {
|
||||
let y = this.y.domain([0, (max*1.1)])
|
||||
let yAxis = d3.axisLeft().scale(y).ticks(3).tickSize(-innerWidth)
|
||||
let xAxis = d3.axisBottom().scale(x).tickFormat(timeFormatPicker(data.length))
|
||||
|
||||
window.xAxis = xAxis;
|
||||
window.data = data;
|
||||
|
||||
// empty previous graph
|
||||
graph.selectAll('*').remove()
|
||||
@ -163,13 +166,7 @@ class Chart extends Component {
|
||||
.call(xAxis)
|
||||
|
||||
// hide all "day" ticks if we're watching more than 100 days of data
|
||||
xTicks.selectAll('g').style('display', (d, i) => {
|
||||
if(data.length > 100 && d.getDate() > 1 ) {
|
||||
return 'none';
|
||||
}
|
||||
|
||||
return '';
|
||||
})
|
||||
xTicks.selectAll('g').filter(d => data.length > 100 && d.getDate() > 1).remove()
|
||||
|
||||
// add data for each day
|
||||
let days = graph.selectAll('g.day').data(data).enter()
|
||||
|
Loading…
x
Reference in New Issue
Block a user