Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Removed negative bar-chart option, added yarn install to deply.yml #1195

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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