Skip to content
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 from pie charts to 100% stacked bar chart #123

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
581b492
Function to create 100% Stacked Bar Chart
iantei Feb 26, 2024
d6f1b82
Add calculate_pct(labels, values) to calculate the proportion.
iantei Feb 26, 2024
5ddc396
Introduce a process_trip_data() to create a dataframe with cols Mode,…
iantei Feb 26, 2024
1165562
Merge list of all dataframes into one.
iantei Feb 26, 2024
2e9ad7d
Remove functions related with Pie Chart from plots.py.
iantei Feb 26, 2024
a55e9f6
Remove code and markdown blocks related with Pie Chart from generic_m…
iantei Feb 26, 2024
7e71308
Add sensed_algo_prefix for generic_metrics notebook.
iantei Feb 26, 2024
45db963
Added load_viz_notebook_sensor_inference_data() function in generic m…
iantei Feb 26, 2024
ec9037b
Filter for mode_of_interest.
iantei Feb 26, 2024
ebeb9dd
Remove Generic Metrics markdown.
iantei Feb 26, 2024
a1283bb
Markdown and code for 100% Stacked Bar Charts based on Number of Trips.
iantei Feb 26, 2024
441019c
2. 100% Stacked Bar Charts representing 80th of number of trips.
iantei Feb 26, 2024
e53c0cc
3. 100% Stacked Bar Charts representing commute trips.
iantei Feb 26, 2024
eb3dcfc
Clean up.
iantei Feb 26, 2024
e582011
4. 100% Stacked Bar Charts representing Distance by Mode.
iantei Feb 26, 2024
5fedbb0
5. 100% Stacked Bar Charts representing Count by Purpose.
iantei Feb 26, 2024
f31e43e
6. 100% Stacked Bar Charts representing Replaced mode.
iantei Feb 26, 2024
7b6cef2
Update markdown for 6.
iantei Feb 26, 2024
428982c
7. 100% Stacked Bar Charts representing Trip Distance based on Replac…
iantei Feb 26, 2024
119d707
Update Markdown text.
iantei Feb 26, 2024
1c5e00a
Copied the bar plots from generic_metrics_sensed notebook to generic_…
iantei Feb 26, 2024
4d58d4c
Copied the bar plots from mode_specific_metrics notebook to generic_m…
iantei Feb 26, 2024
7f31c5d
Added Store alt text function for stacked bar charts. Added html tabl…
iantei Feb 26, 2024
3388258
Added alt_text for stacked bar charts in generic metric notebook.
iantei Feb 26, 2024
11345f6
Retrieve htmlFile in index.html.
iantei Feb 26, 2024
2f7b0da
Update data-sizex to 8 from 4 for ntrips_mode_confirm.
iantei Feb 26, 2024
c17027d
Add X and Y axis labels.
iantei Feb 27, 2024
5d83605
Update the quality text for sensed in scaffolding.py
iantei Feb 27, 2024
f91f379
Update the default loaded configs.
iantei Feb 27, 2024
339f0cd
Remove older file names and option values associated with it. Update …
iantei Feb 27, 2024
1cc1254
Update the file names. Remove print statements.
iantei Feb 27, 2024
c2c0576
Rotate the X- axis ticks by 90, and provide last updated text below X…
iantei Feb 27, 2024
c639d89
For Stacked Bar Charts: 1. Update the plots title. 2. rename file fro…
iantei Feb 27, 2024
687633f
Experiment with adding html file in the same widget as image.
iantei Feb 27, 2024
66cb274
Changed the option value from miles_ to distance for Stacked Bar Chart.
iantei Feb 27, 2024
ddcfb1c
Added new widget for the additional information table with a checkbox…
iantei Feb 29, 2024
a95225a
Round up the pct values in the table to one decimal place, and format…
iantei Feb 29, 2024
cad3b1d
Update the data-sizex for distance_ option value.
iantei Feb 29, 2024
328c185
Update the legend to showcase (Sensed) for all the Sensed modes. Adde…
iantei Feb 29, 2024
07b08c8
Enable the checkbox only for the Stacked Bar Charts.
iantei Feb 29, 2024
eed9a0e
Uncheck the checkbox when switching to non-Stacked Bar Chart related …
iantei Feb 29, 2024
eb83f5c
Revert changes implemented for checkbox.
iantei Mar 1, 2024
ce3e38d
Added More Info button alongside the plot title for Stacked Bar Charts.
iantei Mar 1, 2024
c3a7273
Removed ntrips_ebike_purpose, and introduced ntrips_ebike_replaced_mode.
iantei Mar 1, 2024
ef5574f
Fix the ntrips_replaced_mode value.
iantei Mar 1, 2024
4c8eb68
Update to keep both alt_text as well as alt_html in a single function.
iantei Mar 1, 2024
41324d2
Removed store_alt_text function related with pie chart.
iantei Mar 1, 2024
90e2bf9
Update merged_debug_df to appropriate functions.
iantei Mar 1, 2024
052fb54
Update all Stacked Bar Charts to store both alt_text and alt_html fil…
iantei Mar 1, 2024
77e963d
Refactor Stacked Bar Chart 1. Now handles case when we have only one …
iantei Mar 1, 2024
6718f5f
Refactor Stacked Bar Chart 2. Now handles case when we have only one …
iantei Mar 1, 2024
7fa150e
Refactor Stacked Bar Chart 3. Now handles case when we have only one …
iantei Mar 1, 2024
1b9a15c
Refactor Stacked Bar Chart 4. Now handles case when we have only one …
iantei Mar 1, 2024
7e4d3aa
Refactor Stacked Bar Chart 5. Now handles case when we have only one …
iantei Mar 1, 2024
2e84f41
Refactor Stacked Bar Chart 6. Now handles case when we have only one …
iantei Mar 1, 2024
4112448
Refactor Stacked Bar Chart 7. Now handles case when we have only one …
iantei Mar 1, 2024
64abfb3
Update dist block for average_miles_mode_confirm.
iantei Mar 1, 2024
a9b2fa3
Removed and merged number of trips and distance related Mode_Specific…
iantei Mar 1, 2024
ac7475d
Remove all changes associated with Mode Specific ntrips and distance …
iantei Mar 1, 2024
5aafc02
Mode_of_interest needs to not None for it be available.
iantei Mar 1, 2024
87289ab
Update <= for the cutoff.
iantei Mar 1, 2024
2bae83c
Handle expanded_ct, expanded_ct empty cases. 2. Fill up the empty lis…
iantei Mar 1, 2024
e97c20b
Remove generic_metrics_sensed and mode_specific_metrics notebooks. Re…
iantei Mar 1, 2024
b554005
Corrected the heading for under 80th Stack Chart.
iantei Mar 2, 2024
8450622
Added the metric/imperial notation of distance in chart title.
iantei Mar 2, 2024
01cadb4
Fix text representation for distance_mode.
iantei Mar 2, 2024
2819568
Update the data-sizex of average_miles_replaced_mode identical to oth…
iantei Mar 2, 2024
d033234
Update option value from distance_mode to total_trip_length, and upda…
iantei Mar 2, 2024
067e242
Simplify the selection of stacked metrics using boolean check only.
iantei Mar 7, 2024
8e7292a
Updated the text to showcase as under 80th percentile for ntrips_unde…
iantei Mar 7, 2024
4542530
frontend/metrics_program.html
iantei Mar 7, 2024
29b60d4
Shortened the text for ntrips_purpose.
iantei Mar 7, 2024
66b2397
Update use_imperial for Miles in average_miles_replaced_mode.
iantei Mar 7, 2024
376e064
Simplify process_data_for_cutoff().
iantei Mar 11, 2024
d5c15bd
Simplify process_data_frame() for Based on Number of Trips.
iantei Mar 11, 2024
59236a1
Re-used process_data_frame() instead of process_trip_purpose_data().
iantei Mar 11, 2024
21716f8
Renamed data_frame to df and column_name to df_col, and third param t…
iantei Mar 11, 2024
ae9c309
Update the text value for total_trip_length to align with others.
iantei Mar 12, 2024
976c636
Changes to reduce size when there is single bar present in the 100% S…
iantei Mar 12, 2024
5b82f6e
Update the legend box to pin it to the upper left corner and with fon…
iantei Mar 12, 2024
d3e531d
Update the plot_title_no_quality for Total Trip Length stacked bar ch…
iantei Mar 12, 2024
64c02e4
Change from label_units to label_units_lower for Total trip length ch…
iantei Mar 12, 2024
cda15cc
Shorten Stacked Bar Charts' Trip Type labels.
iantei Mar 12, 2024
f6c7144
Update trip type param text for df_purpose_trip_eb.
iantei Mar 14, 2024
d354641
Segregate sensed land, Replace mode based charts into different Stack…
iantei Mar 22, 2024
b5da35b
Fix for the error RuntimeError(Unknown return type) in Stacked Bar Ch…
iantei Mar 22, 2024
b33426e
Added metrics dropdown for 1.Number of total trips by replaced mode. …
iantei Mar 22, 2024
4dd2f8f
Remove process_distance_data() function from Replaced Mode block.
iantei Mar 22, 2024
30b7f68
Update Labeled bar for land based distance computation (Stacked Bar C…
iantei Mar 22, 2024
bfba1f1
Limit generation of charts in accordance with study_type.
iantei Mar 22, 2024
ba1c038
Remove unnecessary extra block of code.
iantei Mar 22, 2024
531e510
Update the study_type to program from study.
iantei Mar 22, 2024
541a973
Update the metric list description for ntrips_total_replaced_mode.
iantei Mar 22, 2024
9270ea9
Update access to data_eb and expanded_ct after the check of it not be…
iantei Mar 24, 2024
310f36e
Update else statement.
iantei Mar 24, 2024
6a3684b
Added by land in plot_title_no_quality.
iantei Mar 24, 2024
9954f40
Update Markdown for individual Stacked Bar Charts.
iantei Mar 24, 2024
98eabec
Merge remote-tracking branch 'origin/main' into Change-from-Pie-Chart…
iantei Apr 11, 2024
4b1a6dc
Remove Bar Charts code block related to mode_specific_metrics.
iantei Apr 11, 2024
4816be9
Remove Pie Chart related code from mode_specific_metrics notebook.
iantei Apr 11, 2024
fbf8494
Update data_eb groupby computation for the Average miles per trip for…
iantei Apr 11, 2024
b126cb3
Shift the implementation of mode specific trips by purpose to mode_sp…
iantei Apr 11, 2024
259ee32
Shift the implementation of mode specific Total Trip Length to mode_s…
iantei Apr 11, 2024
e4a81a1
Shift the implementation of mode specific Number of Trips to mode_spe…
iantei Apr 11, 2024
a6535a7
Remove mode_specific_metrics related computation of data_eb and quali…
iantei Apr 11, 2024
1f4259a
1. Create dictionary of sensed mode from this list of sensed labels. …
iantei Apr 11, 2024
d03357a
Remove mapping with Sensed prefix for legend since we will have disti…
iantei Apr 11, 2024
4c8e726
Add colors_combined dictionary as the arg for stacked_bar_chart_gener…
iantei Apr 11, 2024
cee1111
Update colors_combined dictionary returned from mapping_color_labels …
iantei Apr 11, 2024
cc6c436
Replace calculate_pct with merge_small_entries, and use it to compute…
iantei Apr 11, 2024
d25b3b5
Keep index for enumerate inside stacked_bar_chart_generic()
iantei Apr 11, 2024
e4cad01
Update subplot implementation for stacked bar chart.
iantei Apr 12, 2024
432c5ec
Change from stacked_bar_chart_generic to plot_stacked_bar_chart().
iantei Apr 12, 2024
e004a7d
Change from stacked_bar_chart_generic to plot_stacked_bar_chart() for…
iantei Apr 12, 2024
df92dfb
Fix alt html function call for generic_metrics notebook.
iantei Apr 12, 2024
753331a
Fix alt html function call for mode_specific_metrics notebook.
iantei Apr 12, 2024
a569ead
1. Initilize all_data_frames_commute for commute metrics. 2. Update t…
iantei Apr 12, 2024
78c724e
1. Update to use all_data_frames instead of list of individual df for…
iantei Apr 12, 2024
90957da
Fix for alt_html u80 metric chart in generic_metrics notebook.
iantei Apr 12, 2024
c3fc043
Fix for mode_specific_metrics notebook alt_html.
iantei Apr 12, 2024
0766b2e
Only return and store alt_html. alt_txt removed.
iantei Apr 12, 2024
b0030aa
Use expanded dataframe to create alt_html.
iantei Apr 12, 2024
dcf4290
Update all Stacked Bar Chart metrics with expansion button option.
iantei Apr 12, 2024
96bd2fe
Update option value for mode specifc metrics.
iantei Apr 12, 2024
bca500f
Update file names for mode_specific_metrics Stacked Bar Chart files.
iantei Apr 12, 2024
e583900
Add mode_specific_metrics notebook for generate_plots.py in crontab.
iantei Apr 12, 2024
4eb6f8a
Scale down the stacked bar chart to maintain aspect ratio.
iantei Apr 12, 2024
00cd1de
1. Remove mode_of_interest from generic_metrics notebook. 2. Split me…
iantei Apr 12, 2024
59cd9b2
Restore changes with alt_text.
iantei Apr 16, 2024
e627a86
Update changes for ntrips_mode_of_interest_purpose metric.
iantei Apr 16, 2024
deccaa8
Update input param description for process_trip_data().
iantei Apr 16, 2024
ed835a5
Shift process_data_frame(), process_distance_data(), process_data_for…
iantei Apr 16, 2024
277e4f8
Update the button name from addButton to additionalInfoButton.
iantei Apr 16, 2024
f785d59
Use mode_studied instead of data.intro.mode_studied.
iantei Apr 17, 2024
625a65f
Remove unnecessary console.log statements.
iantei Apr 17, 2024
bf09575
Remove 'Other' since it's already part of purpose_labels.csv.
iantei Apr 18, 2024
874108c
Remove extra lines. Remove unnecessary import.
iantei Apr 18, 2024
ccb7126
1. Split plot_stacked_bar_chart() to plot fig title separately. 2. Wh…
iantei Apr 24, 2024
de6f326
1. Remove consolidated list of dataframes call to plot_stacked_bar_ch…
iantei Apr 24, 2024
6e6936a
1. Remove consolidated list of dataframes call to plot_stacked_bar_ch…
iantei Apr 24, 2024
cac7b7f
Update index for Stacked Bar Charts.
iantei Apr 24, 2024
8ea9e15
Restore default use_imperial to True.
iantei Apr 24, 2024
477b213
Merge branch 'main' into Change-from-Pie-Charts-to-100%-Stacked-Bar-C…
iantei Apr 24, 2024
f993363
Refactor to add comments. Update variable names.
iantei Apr 25, 2024
dcfe978
Move the call to plot_stacked_bar_chart() inside the check of their d…
iantei Apr 26, 2024
4bfe65f
Move the call to plot_stacked_bar_chart() inside the check of their d…
iantei Apr 26, 2024
f9e2cde
Remove use of combined all_frames_expanded list. Remove existing appr…
iantei Apr 26, 2024
6749182
Create call to create_alt_text/html_title() and store_alt_text/html_s…
iantei Apr 26, 2024
a02bb8d
Remove use of combined all_frames_expanded list. Remove existing appr…
iantei Apr 26, 2024
de9b086
Remove use of combined all_frames_expanded list. Remove existing appr…
iantei Apr 26, 2024
b796302
1. Update the arg in access_alt_text/html with write_permission. 2. R…
iantei Apr 26, 2024
d993181
Introduce create_alt_text/html() to add overall plot title in text/html.
iantei Apr 26, 2024
fa0da1f
1. Remove arg write_permission. 2. Pass 'w' or 'a' based from the fun…
iantei Apr 26, 2024
0cc2cc8
1. Remove write_permission args. 2. Move plot_stacked_bar_chart() out…
iantei Apr 26, 2024
37dc0aa
1. Remove write_permission args. 2. Move plot_stacked_bar_chart() out…
iantei Apr 26, 2024
44bbb03
Update the plot title when none of the dataframe is available for gen…
iantei Apr 26, 2024
8b918aa
Fix alt_text formatting of extra new line.
iantei Apr 26, 2024
704df5a
Remove write_persmission info. Update the function comment for create…
iantei Apr 26, 2024
a83e15d
1. Remove the initialization of empty data frame. 2. Remove check for…
iantei Apr 29, 2024
dde65d0
1. Remove empty df initialization. 2. Remove check for empty data fra…
iantei Apr 30, 2024
d5d1bff
Change Mode to Label and Count to Value in plots.py.
iantei Apr 30, 2024
16b389d
Update the text formatting for store_alt_text_stacked_bar_chart.
iantei Apr 30, 2024
d8e73a6
Remove Trip Type as column from the data frame for Stacked Bar Chart.…
iantei Apr 30, 2024
3e0c2b2
Remove Labeled/Sensed by ... message from call to process_*() and use…
iantei Apr 30, 2024
46e3a4a
Remove Labeled/Sensed by ... message from call to process_*() and use…
iantei Apr 30, 2024
fca63a3
Add try except block in process_*() so that we catch exception for ea…
iantei Apr 30, 2024
e4bd690
1. Handle specialized quality_text to return empty string if the data…
iantei Apr 30, 2024
7f8ad02
Split colors_combined, use individual color dict mapping.
iantei Apr 30, 2024
d00faf1
Resolve merge conflict in viz_scripts/generic_metrics.ipynb.
iantei Apr 30, 2024
9b5bd1a
Resolve merge conflict in generic_metrics notebook.
iantei Apr 30, 2024
50d38ce
Merge store_alt_text and store_alt_html into a single function.
iantei Apr 30, 2024
179dd25
Merge store_alt_text and store_alt_html into a single function for mo…
iantei Apr 30, 2024
893f69d
Merge create_alt_text/html into a single function.
iantei Apr 30, 2024
4f1c385
Refactor code block for Commute Trips in generic_metrics.
iantei Apr 30, 2024
12b00e3
♻️ Heavy lift on the refactoring
shankari May 1, 2024
89ff25d
🔥 Remove the commute processing since it is the same as the general p…
shankari May 1, 2024
ffbde93
🔥 ♻️ Remove the write permission flag for the text file outputs
shankari May 1, 2024
099c8bc
🔥 Remove the merged_debug_df
shankari May 1, 2024
ffb3d81
Fix formatting
shankari May 1, 2024
013ca55
🔥 Remove the code to preprocess cutoffs
shankari May 1, 2024
f7f3590
♻️ Refactor commute and "short trip" charts to fit the new pattern
shankari May 1, 2024
41a5fde
♻️ Change the ordering in which charts are generated in the notebooks
shankari May 2, 2024
271b35f
♻️ Revert extraneous changes
shankari May 2, 2024
996ba7d
♻️ Hopefully last round of refactoring
shankari May 2, 2024
71c2353
Really final refactor
shankari May 2, 2024
008d8a9
♻️ Restore unmodified code to the generic_sensed_metrics notebook
shankari May 2, 2024
ce6f527
♻️ Change the trip purpose to also use the new methods
shankari May 2, 2024
8410d33
🐛 Fixed minor issues found while testing with non-zero data
shankari May 2, 2024
d84833e
🐛 Other minor bug fixes to get the plots that we expect to work to work
shankari May 2, 2024
a22915f
♻️ Final refactor: pass in the aggregation type
shankari May 2, 2024
3542105
Integrate the code refactor changes for Stacked Bar Charts in mode_sp…
iantei May 2, 2024
6b4edf1
🐛 Fix the generation of alt text and HTML for a single bar chart
shankari May 3, 2024
fd0693b
Merge branch 'Change-from-Pie-Charts-to-100%-Stacked-Bar-Chart' of ht…
shankari May 3, 2024
afda252
Showcase the html information as a table with border = 1.
iantei May 3, 2024
139a469
Revert changes from commit id - afda25209125419f50b695f4f57bab9afa22d…
iantei May 4, 2024
c16e4eb
♻️ More clearly delineate the pre-processing and plotting
shankari May 5, 2024
4dbb34c
🥅 Improve error handling across the board
shankari May 5, 2024
3ac8e0f
💄 Handling TODO to display the missing HTML properly
shankari May 5, 2024
5e5bc42
💄 💩 Fix legend display
shankari May 5, 2024
1fcd100
🐛 Fix regression while generating sensed quality text with testers an…
shankari May 5, 2024
238cf8e
♻️A Add the quality text to the bars instead of to the chart title
shankari May 5, 2024
d30503f
♻️ Change the mode specific metrics to use the new library interface
shankari May 5, 2024
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
73 changes: 58 additions & 15 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
return study_name;
}

var mode_studied
$(function () {
$(document).ready(function () {
// Simple solution to program/study plots dropdown; load the config and corresponding metrics.html
Expand All @@ -403,6 +404,7 @@
// get units
const dist_units = (data.display_config.use_imperial) ? "miles" : "kilometers";
console.log("Units for display are", data.display_config.use_imperial, dist_units);
mode_studied = data.intro.mode_studied
shankari marked this conversation as resolved.
Show resolved Hide resolved
// Load list of plots corresponding to study/program
dynamic_labels = data.label_options
if (data.intro.program_or_study == 'program') {
Expand All @@ -417,18 +419,17 @@
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
}
$.get(load_file, function (response) {
const configuredResponse = response.replaceAll("${data.intro.mode_studied}", data.intro.mode_studied);
const configuredResponse = response.replaceAll("${data.intro.mode_studied}", mode_studied);
console.log("configuring units");
const unitConfigured = configuredResponse.replaceAll("${data.display_config.use_imperial}", dist_units);
$('#metric').append(unitConfigured);
addPreconfiguredMetrics([
"ntrips_mode_confirm",
"miles_mode_confirm",
"ntrips_sensed_mode",
"miles_sensed_mode",
`ntrips_${data.intro.mode_studied}_purpose`,
`ntrips_${data.intro.mode_studied}_per_weekday`,
`sketch_CO2impact_${data.intro.mode_studied}`
"ntrips_total",
"total_trip_length",
"ntrips_purpose",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also be split when we move the mode specifc metrics back

`ntrips_${mode_studied}_purpose`,
`ntrips_${mode_studied}_per_weekday`,
`sketch_CO2impact_${mode_studied}`
]);
});
}
Expand All @@ -450,10 +451,8 @@
const unitConfigured = response.replaceAll("${data.display_config.use_imperial}", dist_units);
$('#metric').append(unitConfigured);
addPreconfiguredMetrics([
"ntrips_mode_confirm",
"miles_mode_confirm",
"ntrips_sensed_mode",
"miles_sensed_mode",
"ntrips_total",
"total_trip_length",
"ntrips_purpose",
"ntrips_sensed_per_weekday",
"ts_emissions_user"
Expand Down Expand Up @@ -531,15 +530,59 @@
// and without this change, even if we set the dateVal to ''
// we would try to load ntrips_purpose__default.png
const imgFile = "plots/" + metric + "_" + dateVal + program + ".png";
const htmlFile = "plots/" + metric + "_" + dateVal + program + ".html";
const altTextFile = "plots/" + metric + "_" + dateVal + program + ".txt";
Comment on lines +533 to 534
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both HTML and alt text? Now that we have the HTML file, I think we can get permission from Comms and remove alt-text in the next (label assist results incorporated) mode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do have the same information, maybe if we implement the html as swapping in for the chart instead of being it's own grid element then we can move forward with it being a 1:1 swap for the alt text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the meeting discussion, we are keeping both HTML as well as alt text, while not modifying any the changes to showcase toggling between chart and html table.

const altText = loadFile(altTextFile);
const nw = ["<li data-min-sizex='2' data-min-sizey='2'>"
const isStackedMetric = ['ntrips_total', 'ntrips_purpose', 'ntrips_under80', 'ntrips_commute_mode_confirm',
'total_trip_length', 'total_trip_length_land',`ntrips_${mode_studied}_total`,
`ntrips_${mode_studied}_purpose`,`total_trip_length_${mode_studied}_replaced_mode`]
.includes(metric);
const jsonData = { metric, dateVal, program, metricLabel, dateLabel, programLabel, sizex, sizey };

if (isStackedMetric){
const nw = ["<li data-min-sizex='2' data-min-sizey='2'>"
+ labelText
+ "&nbsp;"
+ "<button class= 'btn btn_default addInfo' style='color: black; background-color: none; border-color: white;' data-info='" + encodeURIComponent(JSON.stringify(jsonData))+ "'> More Info </button>"
shankari marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +542 to +546
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not going to hold up the merge for this, but I am not sure why we only show the additional HTML for stacked metrics. Why would we not show it for all metrics? Again, with the screenreader use case, maybe the person wants to see/export data for other metrics as well

+ "&nbsp;"
+ "<button class='remove'>x</button>"
+ "<img src='" + imgFile + "' alt='" + altText + "' style='width: 99%; height: 90%; object-fit: scale-down;'>"
+ "</li>",
sizex, sizey];
gridster.add_widget.apply(gridster, nw);
}
else{
const nw = ["<li data-min-sizex='2' data-min-sizey='2'>"
+ labelText
+ "<button class='remove'>x</button>"
+ "<img src='" + imgFile + "' alt='" + altText + "' width=90% height=90%>"
+ "</li>",
sizex, sizey];
gridster.add_widget.apply(gridster, nw);
}
});

$('body').on("click", ".gridster ul > li .addInfo", function () {
const additionalInfoButton = $(this);
const additionalInfo = JSON.parse(decodeURIComponent(additionalInfoButton.data('info')));
const metric = additionalInfo.metric;
const dateVal = additionalInfo.dateVal;
const program = additionalInfo.program;
const metricLabel = additionalInfo.metricLabel;
const dateLabel = additionalInfo.dateLabel;
const programLabel = additionalInfo.programLabel;
const sizex = additionalInfo.sizex;
const sizey = additionalInfo.sizey;
const labelText = metricLabel + " " + dateLabel + " " + programLabel;
const htmlFile = "plots/" + metric + "_" + dateVal + program + ".html";

const nw_additionalInformation = ["<li data-min-sizex='2' data-min-sizey='2'>"
+ labelText
+ "<button class='remove'>x</button>"
+ "<img src='" + imgFile + "' alt='" + altText + "' width=90% height=90%>"
+ "<object data='" + htmlFile + "' type='text/html' style='margin-top: 20px;' width='90%' height='90%'></object>"
+ "</li>",
sizex, sizey];
gridster.add_widget.apply(gridster, nw);
gridster.add_widget.apply(gridster, nw_additionalInformation);
shankari marked this conversation as resolved.
Show resolved Hide resolved
});

$('body').on("click", ".gridster ul > li .remove", function () {
Expand Down
22 changes: 10 additions & 12 deletions frontend/metrics_program.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 80th pecentile</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 80th percentile (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip length by land mode (sensed)</option>
<option value="ntrips_total" data-sizex="10" data-sizey="4">Number of trips</option>
<option value="ntrips_under80" data-sizex="10" data-sizey="4">Number of trips (under 80th percentile of total trips)</option>
<option value="ntrips_commute_mode_confirm" data-sizex="10" data-sizey="4">Number of commute trips</option>
<option value="total_trip_length" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode</option>
<option value="total_trip_length_land" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode in land</option>
<option value="ntrips_purpose" data-sizex="10" data-sizey="4">Number of trips by purpose</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial})</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial}) (sensed)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
Expand All @@ -20,9 +17,10 @@
<option value="ts_users" data-sizex="8" data-sizey="2">Timeseries of active users</option>
<option value="ts_all_modes" data-sizex="8" data-sizey="2">Timeseries of all mode shares</option>
<!-- Mode Specific -->
<option value="ntrips_${data.intro.mode_studied}_purpose" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip count by purpose</option>
<option value="miles_${data.intro.mode_studied}_replaced_mode" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip length (${data.display_config.use_imperial}) by replaced mode</option>
<option value="average_miles_replaced_mode" data-sizex="4" data-sizey="4">Average Miles for each replaced mode (w/Other)</option>
<option value="ntrips_${data.intro.mode_studied}_purpose" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific trip count by purpose</option>
<option value="ntrips_${data.intro.mode_studied}_total" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific number of trips by replaced mode</option>
<option value="total_trip_length_${data.intro.mode_studied}_replaced_mode" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific trip length (${data.display_config.use_imperial}) by replaced mode</option>
<option value="average_miles_replaced_mode" data-sizex="6" data-sizey="4">Average ${data.display_config.use_imperial} for each replaced mode (w/Other)</option>
<option value="ntrips_${data.intro.mode_studied}_per_day" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trip frequency</option>
<option value="ntrips_${data.intro.mode_studied}_per_weekday" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trips per weekday</option>
<option value="sketch_energy_impact_${data.intro.mode_studied}" data-sizex="6" data-sizey="4">Sketch of `${data.intro.mode_studied}` specific energy impact</option>
Expand Down
22 changes: 10 additions & 12 deletions frontend/metrics_program_withoutEnergyMetrics.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!-- Replica of metrics_program.html without energy options-->
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 80th percentile</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 80th percentile (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip length by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by land mode (sensed)</option>
<option value="ntrips_total" data-sizex="10" data-sizey="4">Number of trips</option>
<option value="ntrips_under80" data-sizex="10" data-sizey="4">Number of trips (under 80th percentile of total trips)</option>
<option value="ntrips_commute_mode_confirm" data-sizex="10" data-sizey="4">Number of commute trips</option>
<option value="total_trip_length" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode</option>
<option value="total_trip_length_land" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode in land</option>
<option value="ntrips_purpose" data-sizex="10" data-sizey="4">Number of trips by purpose</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial})</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial}) (sensed)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
Expand All @@ -20,9 +17,10 @@
<option value="ts_users" data-sizex="8" data-sizey="2">Timeseries of active users</option>
<option value="ts_all_modes" data-sizex="8" data-sizey="2">Timeseries of all mode shares</option>
<!-- Mode Specific -->
<option value="ntrips_${data.intro.mode_studied}_purpose" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip count by purpose</option>
<option value="miles_${data.intro.mode_studied}_replaced_mode" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip distance (${data.display_config.use_imperial}) by replaced mode</option>
<option value="average_miles_replaced_mode" data-sizex="4" data-sizey="4">Average Miles for each replaced mode (w/Other)</option>
<option value="ntrips_${data.intro.mode_studied}_purpose" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific trip count by purpose</option>
<option value="ntrips_${data.intro.mode_studied}_total" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific number of trips by replaced mode</option>
<option value="total_trip_length_${data.intro.mode_studied}_replaced_mode" data-sizex="10" data-sizey="4">`${data.intro.mode_studied}` specific trip length (${data.display_config.use_imperial}) by replaced mode</option>
<option value="average_miles_replaced_mode" data-sizex="6" data-sizey="4">Average ${data.display_config.use_imperial} for each replaced mode (w/Other)</option>
<option value="ntrips_${data.intro.mode_studied}_per_day" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trip frequency</option>
<option value="ntrips_${data.intro.mode_studied}_per_weekday" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trips per weekday</option>
<option value="sketch_CO2impact_${data.intro.mode_studied}" data-sizex="6" data-sizey="4">Sketch of `${data.intro.mode_studied}` specific emission impact</option>
Expand Down
15 changes: 6 additions & 9 deletions frontend/metrics_study.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 80th percentile</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 80th percentile (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip length (${data.display_config.use_imperial}) by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip length by land mode (${data.display_config.use_imperial}) (sensed)</option>
<option value="ntrips_total" data-sizex="10" data-sizey="4">Number of trips</option>
<option value="ntrips_under80" data-sizex="10" data-sizey="4">Number of trips (under 80th percentile of total trips)</option>
<option value="ntrips_commute_mode_confirm" data-sizex="10" data-sizey="4">Number of commute trips</option>
<option value="total_trip_length" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode</option>
<option value="total_trip_length_land" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode in land</option>
<option value="ntrips_purpose" data-sizex="10" data-sizey="4">Number of trips by purpose</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial})</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial}) (sensed)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
Expand Down
15 changes: 6 additions & 9 deletions frontend/metrics_study_withoutEnergyMetrics.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!-- Replica of metrics_study.html without energy option-->
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 80th Percentile</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 80th Percentile (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip distance (${data.display_config.use_imperial}) by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip distance (${data.display_config.use_imperial}) by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip distance by land mode (sensed)</option>
<option value="ntrips_total" data-sizex="10" data-sizey="4">Number of trips</option>
<option value="ntrips_under80" data-sizex="10" data-sizey="4">Number of trips (under 80th percentile of total trips)</option>
<option value="ntrips_commute_mode_confirm" data-sizex="10" data-sizey="4">Number of commute trips</option>
<option value="total_trip_length" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode</option>
<option value="total_trip_length_land" data-sizex="10" data-sizey="4">Total trip length (${data.display_config.use_imperial}) covered by mode in land</option>
<option value="ntrips_purpose" data-sizex="10" data-sizey="4">Number of trips by purpose</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial})</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (${data.display_config.use_imperial}) (sensed)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
Expand Down
Loading