dams-mcda / Dams-MCDA

Emma Fox R/Shiny Project with a docker server configuration
1 stars 0 forks source link

Task 13 (Step 4: View Results) WW/EF #80

Closed elbfox closed 4 years ago

elbfox commented 5 years ago

In each dam Results page, add (in order from top to bottom): 1) a bar graph that shows the preference scores for each decision criterion for that dam (what is now currently shown at the bottom of the preference elicitation pages - e.g., "Raw Scores of Alternative 5" on the current Alternative 5 page); 2) a second bar graph that shows the total weighted MCDA scores for each decision alternative for that dam, stacked with the component scores for the decision criteria; 3) a table with decision alternatives for the rows and decision criteria for the columns and the preference-weighted MCDA scores in the cells, with an ending TOTAL column (i.e., the output decision matrix from the MOGA for that dam); Each of these 3 sets of results will have titles and text above them explaining to the user what they are seeing (Emma will provide these titles and text) and there will need to be links back to the same materials from the Read This links (step 3, task 13) so the user can follow the flow of knowledge from original dam data matrix to normalized data matrix to preference scores to final MCDA scores. Add download capability for graphs.

Will want error bars on the decision alternatives to show some uncertainty for: fish survival and river recreation (network dependent criteria)

elbfox commented 4 years ago

In the "IndividualDamOutput" branch. Sorry, looks like I meant 996:

            #----------------------------------------
            # run WSM and get data ready for graphs
            #----------------------------------------
            WSMResults <- WSM(RawCriteriaMatrix, NormalizedMatrix, DamsData, Decisions)

            WSMMatrix <- array(unlist(WSMResults[1]), dim=c(5,14,8))
sythel commented 4 years ago

In the "IndividualDamOutput" branch. Sorry, looks like I meant 996:

          #----------------------------------------
          # run WSM and get data ready for graphs
          #----------------------------------------
          WSMResults <- WSM(RawCriteriaMatrix, NormalizedMatrix, DamsData, Decisions)

          WSMMatrix <- array(unlist(WSMResults[1]), dim=c(5,14,8))

this sets WSMMatrix to first result from calling WSM()

elbfox commented 4 years ago

Ok, then I'm out of ideas for what is causing the problem. The two graphs need to show bars of the same height, and they used to in DamsReOrder branch. Right now, they're contradicting each other. The bars in plot A should be the height of the summed scores, segmented by the weighted criteria scores that add to the total.

sythel commented 4 years ago

I think I could achieve the graph in the first picture easily i'm just confused which to modify. the second graph picture depicts plotB as it is now

do we want to remove/edit plotB (figure 5 on live site) or plotA (figure 4 on live site)

dam output page graphs (ordering as of now)

  1. plotC
  2. plotA
  3. plotB
elbfox commented 4 years ago

The graph in the first picture (Fig 7) is achieved using the following in server.R

    # (d) has three graphs for each dam
    # d1
    plotA <- renderPlot2D(
        ResultsMatrix[,,damId],
        "D 1", # title
        alternative_names, # x_labels
        criteria_names, # y_labels
        "Alternative", # x axis label
        "Score", # y axis label
        "Criteria", # legend label
        colors, # colors
        NULL, # x value limit
        c(0, max_slider_value) # y value limit (100 in this case)
    )
    output[[paste0("WSMPlot", damId, "a")]] <- renderPlot(plotA)

    # download button for d1 plot as png
    output[[paste0("DownloadDam", damId, "Plota")]] <- downloadHandler(
        filename = function() {
            format(Sys.time(), "WestEnfield_plota_results_%Y-%m-%d_%H-%M-%S_%z.png")
        },
        content = function(file) {
            ggsave(file, plot=plotA, device = "png", width=18, height=14)
        }

We want to keep them both. Because although b is redundant, but it makes a point. Sharon hasn't had a chance to review yet, so we may ultimately decide to pull it, but I'll let her make that call.

sythel commented 4 years ago

so im going to rotate plotA, here's a preview

sythel commented 4 years ago

3306fd4 @elbfox pushed to live server to test

elbfox commented 4 years ago

Thank you, I just made the same change here for consistency. Closing issue