diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js index 57e83ef62c44b..5a1cdc185ac4f 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js @@ -27,8 +27,6 @@ import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue // see https://github.com/uber/react-vis/issues/1214 const getNull = d => isValidCoordinateValue(d.y) && !isNaN(d.y); -const X_TICK_TOTAL = 7; - class StaticPlot extends PureComponent { getVisSeries(series, plotValues) { return series @@ -141,12 +139,23 @@ class StaticPlot extends PureComponent { } render() { - const { series, tickFormatX, tickFormatY, plotValues, noHits } = this.props; + const { + width, + series, + tickFormatX, + tickFormatY, + plotValues, + noHits + } = this.props; const { yTickValues } = plotValues; + // approximate number of x-axis ticks based on the width of the plot. There should by approx 1 tick per 100px + // d3 will determine the exact number of ticks based on the selected range + const xTickTotal = Math.floor(width / 100); + return ( - + {noHits ? (
{ onHover={onHover} onMouseLeave={onMouseLeave} onSelectionEnd={onSelectionEnd} - width={100} + width={800} tickFormatX={x => x.getTime()} // Avoid timezone issues in snapshots /> ); diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap index ad3b3d25fa4c6..aeef8ed995e92 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/test/__snapshots__/CustomPlot.test.js.snap @@ -5836,7 +5836,7 @@ Array [ style={ Object { "height": "256px", - "width": "100px", + "width": "800px", } } > @@ -5850,7 +5850,7 @@ Array [ onMouseLeave={[Function]} onMouseMove={[Function]} onWheel={[Function]} - width={100} + width={800} > @@ -5895,7 +5895,7 @@ Array [ @@ -6213,7 +6213,7 @@ Array [ onMouseLeave={[Function]} onMouseMove={[Function]} onWheel={[Function]} - width={100} + width={800} />