Skip to content

Commit

Permalink
Merge pull request #1195 from explorable-viz/text-viz
Browse files Browse the repository at this point in the history
Removed negative bar-chart option, added yarn install to deply.yml
  • Loading branch information
JosephBond authored Dec 11, 2024
2 parents 88c02bb + 3d01096 commit 8206279
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- run: |
yarn install
yarn npm-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions fluid/example/text-viz/left-barchart-table.fld
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[
{ type: "Total", emissions: 1.35 },
{ type: "CO2", emissions: 1.1 },
{ type: "Non-CO2", emissions: 0.41 },
{ type: "Aerosols & Land", emissions: -0.17}
{ type: "Non-CO2", emissions: 0.41 }
]
3 changes: 1 addition & 2 deletions fluid/example/text-viz/right-barchart-table.fld
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[
{ type: "Total", emissions: 2.7 },
{ type: "CO2", emissions: 2.1 },
{ type: "Non-CO2", emissions: 0.6 },
{ type: "Aerosols & Land", emissions: -0.21}
{ type: "Non-CO2", emissions: 0.6 }
]
6 changes: 3 additions & 3 deletions src/App/View/BarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function drawBarChart_ (
const nearest = 10,
y_max = Math.ceil(Math.max(...stackedBars.map(d => barHeight(d.bars))) / nearest) * nearest
const y = d3.scaleLinear()
.domain([-y_max, y_max])
.domain([0, y_max])
.range([height, 0])
.nice()
const tickEvery_n = tickEvery(y_max),
Expand Down Expand Up @@ -145,9 +145,9 @@ function drawBarChart_ (
.append('rect')
.attr('class', 'bar')
.attr('x', bar => { return x(bar.x) })
.attr('y', bar => { return y(Math.max(bar.y + bar.height, 0)) })
.attr('y', bar => { return y(bar.y + bar.height) })
.attr('width', x.bandwidth())
.attr('height', bar => { return Math.abs(height - y(bar.height) - strokeWidth - y(0)) }) // stop bars overplotting
.attr('height', bar => { return height - y(bar.height) - strokeWidth }) // stop bars overplotting
.attr('stroke-width', _ => strokeWidth)

const legendLineHeight = 15,
Expand Down

0 comments on commit 8206279

Please # to comment.