From c7542bce59ad88aee8e1546fafe7b6fb931f613d Mon Sep 17 00:00:00 2001 From: Chris Vickery Date: Thu, 19 Jul 2018 17:15:52 -0700 Subject: [PATCH] Make plot X axis start always line up (#9) --- src/components/CanGraph.js | 4 ++-- src/vega/CanPlot.js | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/CanGraph.js b/src/components/CanGraph.js index 2582f84..8bc98c0 100644 --- a/src/components/CanGraph.js +++ b/src/components/CanGraph.js @@ -80,8 +80,8 @@ export default class CanGraph extends Component { this.setState({ bounds }); this.view.run(); - this.view.signal("width", bounds.width); - this.view.signal("height", 0.4 * bounds.width); // 5:2 aspect ratio + this.view.signal("width", bounds.width - 70); + this.view.signal("height", 0.4 * (bounds.width - 70)); // 5:2 aspect ratio this.view.run(); } diff --git a/src/vega/CanPlot.js b/src/vega/CanPlot.js index e1be4dd..cc6475c 100644 --- a/src/vega/CanPlot.js +++ b/src/vega/CanPlot.js @@ -2,10 +2,14 @@ import { createClassFromSpec } from "react-vega"; export default createClassFromSpec("CanPlot", { $schema: "https://vega.github.io/schema/vega/v3.0.json", - width: 500, + width: 400, height: 200, - padding: "auto", - autosize: { type: "fit", resize: true }, + padding: { + top: 5, + left: 30, + right: 5, + bottom: 10 + }, signals: [ { name: "tipTime",