{"action":"closed","issue":{"url":"https://api.github.com/repos/Samantha-Mcguigan/newsAnalysis/issues/14","repository_url":"https://api.github.com/repos/Samantha-Mcguigan/newsAnalysis","labels_url":"https://api.github.com/repos/Samantha-Mcguigan/newsAnalysis/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/Samantha-Mcguigan/newsAnalysis/issues/14/comments","events_url":"https://api.github.com/repos/Samantha-Mcguigan/newsAnalysis/issues/14/events","html_url":"https://github.com/Samantha-Mcguigan/newsAnalysis/issues/14","id":223372893,"number":14,"title":"Bar Graphs: Troubleshooting","user":{"login":"ebeshero","id":4014518,"avatar_url":"https://avatars3.githubusercontent.com/u/4014518?v=4","gravatar_id":"","url":"https://api.github.com/users/ebeshero","html_url":"https://github.com/ebeshero","followers_url":"https://api.github.com/users/ebeshero/followers","following_url":"https://api.github.com/users/ebeshero/following{/other_user}","gists_url":"https://api.github.com/users/ebeshero/gists{/gist_id}","starred_url":"https://api.github.com/users/ebeshero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebeshero/subscriptions","organizations_url":"https://api.github.com/users/ebeshero/orgs","repos_url":"https://api.github.com/users/ebeshero/repos","events_url":"https://api.github.com/users/ebeshero/events{/privacy}","received_events_url":"https://api.github.com/users/ebeshero/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-21T12:45:55Z","updated_at":"2018-02-23T21:59:02Z","closed_at":"2018-02-23T21:59:02Z","author_association":"COLLABORATOR","body":"@ajnewton1 I had a peek in the eXist-db at your XQuery generating one of those troubled bar graphs, and I think I've spotted the stacking problem. Here's a snip of your code generating a couple of bars on the \"Comparison Between the Amount of Time each Gender Was Quoted\" graph:\r\n\r\n````\r\n    <!-- articles -->\r\n        <rect x=\"20\" y=\"-238\" height=\"{$articles}\" width=\"20\" style=\"stroke: black ; stroke-width: 2;\"/>\r\n        <rect x=\"20\" y=\"-168\" height=\"{$articlesM}\" width=\"20\" style=\"stroke: blue; stroke-width: 2; fill: blue;\"/>\r\n        <rect x=\"20\" y=\"-47\" height=\"{$articlesF}\" width=\"20\" style=\"stroke: pink; stroke-width: 2; fill: pink;\"/>\r\n        \r\n        <!-- election results -->\r\n        <rect x=\"60\" y=\"-29\" height=\"{$ERarticles}\" width=\"20\" style=\"stroke: black; stroke-width: 2;\"/>\r\n        <rect x=\"60\" y=\"-28\" height=\"{$ERarticlesM}\" width=\"20\" style=\"stroke: blue; stroke-width: 2; fill: blue;\"/>\r\n        <rect x=\"60\" y=\"-1\" height=\"{$ERarticlesF}\" width=\"20\" style=\"stroke: pink; stroke-width: 2; fill: pink;\"/>\r\n````\r\n\r\nHere's what I see, and I'm taking my time reading the variables:\r\n1) I'm not sure how you're determining the value of \"y\" for each rectangle--it seems like you're doing the stacking by hand? (It's more robust code to write out the variables that are doing the stacking so we can see what's what--use XQuery as your calculator.)\r\n2) Earlier in your XQuery, here's how you've defined these variables:\r\n````\r\ndeclare variable $articles := count($news//body//quote[@sex]);\r\ndeclare variable $articlesM := count($news//body//quote[@sex=\"m\"]);\r\ndeclare variable $articlesF := count($news//body//quote[@sex=\"f\"]);\r\n````\r\nWhat that tells me is: the `$articles` variable represents a TOTAL COUNT of all the quotes that have an `@sex` attribute. I have a couple of questions about this:\r\n* If `<quote>` has an `@sex`, is it only ever \"m\" or \"f\" in value? (If that's the case, the total count for quote should not exceed the total count of males vs. females. If I remember right, though, you had some quotes where the sex was undetermined/indeterminate. They just shouldn't be so extensive as they're appearing in the long black rectangles on the graph, right?) \r\n* Are there any `<quote>` elements missing the `@sex` attribute? (If so, are they not being counted?)\r\n\r\nOK, if we know that `$articles` (and `$ERarticles` and other variables like it) represent a TOTAL, that total *already contains* the male and female quotes. So when you go to stack  your bar graphs, this one should not be sitting on top of the others. It should be the first bar you draw and it should extend from 0,0 up to the total. (That's something I'd want to double-check to be sure is happening.)\r\n\r\nIf each of your bars superimposes over the others, the bars for males and females need to properly stack, and...I think the problem is that the male bar isn't sitting on top of the female bar, but is being obscured under it. If the bars are being plotted from 0,0 upward, you want to set the **value of the female count + the male count** to determine how high the male bar sits. \r\n\r\nLet's tinker with the variables this morning and see if we can make the stacking work and the code more robust and easier to read. \r\n\r\n "}}
{"actor":{"display_login":"ajnewton1"}}