-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change over time chart #1973
Merged
Merged
Change over time chart #1973
Changes from 46 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
c44dbd2
init changeovertime chart
lastminutediorama 38499e7
add chart elements
lastminutediorama c7548af
lint
lastminutediorama 885e31b
add expansion button
lastminutediorama 94d13eb
vert align
lastminutediorama 94478e2
more complete example data
lastminutediorama e6ee341
add fake data
lastminutediorama 90f72fd
refresh data when dropdowns change
lastminutediorama f24792b
Merge branch 'main' into change-over-time-chart
lastminutediorama 4276eb3
add expanded change chart component
lastminutediorama 7330a74
fix test
lastminutediorama a17e4a7
additions to modal
lastminutediorama 01dcd43
refactor use of state service
lastminutediorama 47e87a9
lint
lastminutediorama d440867
Merge branch 'main' into change-over-time-chart
lastminutediorama 479cff5
scaffold backend call for impacts chart data
lastminutediorama 167746a
connect to backend
lastminutediorama 8175abf
rm some todo comments
lastminutediorama ad70067
rm unused icon
lastminutediorama 8c6c1e2
improve project selection
lastminutediorama 728b53e
fix some tests
lastminutediorama 3a8519e
fix tests
lastminutediorama 555fdd8
fix tests
lastminutediorama 2a06c8c
ensure selected item matches expanded view
lastminutediorama 3fb30ea
unify selection model
lastminutediorama 8294810
Merge branch 'main' into change-over-time-chart
lastminutediorama a3b39f3
map to new backend data fields
lastminutediorama f9490b7
make selections async
lastminutediorama 6598242
recenter map on project area selection
lastminutediorama b64eb4e
Merge branch 'main' into change-over-time-chart
lastminutediorama d8ea8e0
Merge branch 'main' into change-over-time-chart
lastminutediorama 265b7bd
refactor to use responsive reportMetrics
lastminutediorama 0cde2e4
use color-slot obj instead of array
lastminutediorama 396e04c
fix tests
lastminutediorama c9b949d
revert modal width for now
lastminutediorama cac3e09
clean conversions
lastminutediorama 3983e55
Merge branch 'main' into change-over-time-chart
lastminutediorama f018958
add distinctUntilChanged for selected slots
lastminutediorama 1d21b63
fix distinct check
lastminutediorama a052693
add deepEqual instead
lastminutediorama bedbfc3
use 'All' instead of null for All Project selection
lastminutediorama c41b67d
Merge branch 'main' into change-over-time-chart
lastminutediorama ae44915
migrate to sg-expanded-panel
lastminutediorama 6c0cc3c
ws lint
lastminutediorama 089484e
Merge branch 'main' into change-over-time-chart
lastminutediorama da2972b
revert changes to modal component
lastminutediorama 38f3772
rm old state code
lastminutediorama 30b7dfd
move to template vars
lastminutediorama b69ba89
simplify chartData calculation
lastminutediorama 8227599
Merge branch 'main' into change-over-time-chart
lastminutediorama 4a07722
move filter
lastminutediorama 8effd84
linter ws
lastminutediorama 7ea8bc1
fix test
lastminutediorama 36e7eac
local linter needed a fix
lastminutediorama 5e9a002
Merge branch 'main' into change-over-time-chart
lastminutediorama c341455
rm injectable
lastminutediorama b7d7ca8
Merge branch 'main' into change-over-time-chart
lastminutediorama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="chart-heading">Average Change Over Time</div> | ||
<div class="title">Change (%)</div> | ||
<div class="chart"> | ||
<canvas | ||
baseChart | ||
[data]="(barChartData$ | async) || undefined" | ||
lastminutediorama marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[options]="(barChartOptions$ | async) ?? {}" | ||
[legend]="false" | ||
[type]="'bar'"></canvas> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
...interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@import 'colors'; | ||
@import 'mixins'; | ||
|
||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
|
||
.chart-heading { | ||
@include h5(); | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
height: 60px; | ||
align-items: flex-end; | ||
} | ||
|
||
.chart { | ||
height: calc(100% - 140px); | ||
padding-bottom: 20px; | ||
} | ||
|
||
canvas { | ||
flex: 1; | ||
max-height: 100%; | ||
} | ||
|
||
.title { | ||
padding: 24px 24px 0; | ||
color: $color-text-gray; | ||
} |
34 changes: 34 additions & 0 deletions
34
...erface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { DirectImpactsStateService } from '../direct-impacts.state.service'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { MockProvider } from 'ng-mocks'; | ||
import { ChangeOverTimeChartComponent } from './change-over-time-chart.component'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { TreatmentsState } from '../treatments.state'; | ||
import { TreatedStandsState } from '../treatment-map/treated-stands.state'; | ||
|
||
describe('ChangeOverTimeChartComponent', () => { | ||
let component: ChangeOverTimeChartComponent; | ||
let fixture: ComponentFixture<ChangeOverTimeChartComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ChangeOverTimeChartComponent, HttpClientTestingModule], | ||
providers: [ | ||
TreatedStandsState, | ||
MockProvider(TreatmentsState), | ||
MockProvider(DirectImpactsStateService, { | ||
activeStand$: new BehaviorSubject(null), | ||
}), | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ChangeOverTimeChartComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question, are we using this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's for the
deepEqual
in thedistinctUntilChanged
piece. We also don't have anything similar anywhere else, so I thought we could use this, and later maybe replace some JSON.stringify() comparisons we've got.