From 57f552f0b485b3648f1f081c1218167073d63662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20K=C3=B6ves?= <3187531+vkoves@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:03:19 -0500 Subject: [PATCH] Add test spark line --- src/components/BarGraph.vue | 9 +-- src/components/SparkLine.vue | 129 ++++++++++++++++++++++++++++++ src/templates/BuildingDetails.vue | 7 ++ 3 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 src/components/SparkLine.vue diff --git a/src/components/BarGraph.vue b/src/components/BarGraph.vue index 78ded2d7..738c068b 100644 --- a/src/components/BarGraph.vue +++ b/src/components/BarGraph.vue @@ -5,7 +5,7 @@ v-html="graphTitle" /> - + @@ -21,10 +21,7 @@ export interface IGraphPoint { /** * A component that can graph an arbitrary array of numeric data */ -@Component({ - components: { - }, -}) +@Component({}) export default class BarGraph extends Vue { @Prop({required: true}) graphTitle!: string; @@ -48,7 +45,7 @@ export default class BarGraph extends Vue { const outerHeight = this.height + this.graphMargins.top + this.graphMargins.bottom; this.svg = d3 - .select("svg") + .select("svg#bar-graph") .attr("width", outerWidth) .attr("height", outerHeight) .attr("viewBox", `0 0 ${outerWidth} ${outerHeight}`) diff --git a/src/components/SparkLine.vue b/src/components/SparkLine.vue new file mode 100644 index 00000000..d274c819 --- /dev/null +++ b/src/components/SparkLine.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/src/templates/BuildingDetails.vue b/src/templates/BuildingDetails.vue index 28d522a4..c977bc6c 100644 --- a/src/templates/BuildingDetails.vue +++ b/src/templates/BuildingDetails.vue @@ -354,6 +354,11 @@ query ($id: ID!, $ID: String) { :graph-title="currGraphTitle" /> + +

* Note on Rankings: Rankings and medians are among included buildings, which are those who reported under the Chicago Energy Benchmarking Ordinance for @@ -471,6 +476,7 @@ import { Component, Vue } from 'vue-property-decorator'; import { LatestDataYear } from '../constants/globals.vue'; import BarGraph from '~/components/BarGraph.vue'; +import SparkLine from '~/components/SparkLine.vue'; import BuildingImage from '~/components/BuildingImage.vue'; import DataSourceFootnote from '~/components/DataSourceFootnote.vue'; import HistoricalBuildingDataTable from '~/components/HistoricalBuildingDataTable.vue'; @@ -499,6 +505,7 @@ import { IGraphPoint } from '../components/BarGraph.vue'; }, components: { BarGraph, + SparkLine, BuildingImage, DataSourceFootnote, NewTabIcon,