What is the appropriate SQL statement/s to produce a stacked bar chart for multiple random variable distributions?

The Objective

Graph the difference between the probability distributions of sets of random variables that come from a number of different sources using a stacked bar chart (or another type of graph suited for such visualization).

The Problem

I’m not sure of the right combination of SQL SELECT statement(s)/condition(s) to present the data to the graphing tool in the right way to achieve the objective above.

The Method


Feed the source data stored in Google Cloud Platform (GCP)’s BigQuery into Google Data Studio and use a stacked bar graph to visualize the numerous probability distributions.

The Source Data

I’m dealing with simple binary outcomes, either a heads or tails. One trial (== one second) per source yields between 0 to 200 how many heads (1s) were counted.

The schema of the data we have stored in BigQuery is as follows:

time      | source1 | source 2 | ... sourceN --------------------------------------------- 09:00:00  | 99      | 110      | 95         | 09:00:01  | 101     | 115      | 107        | 09:00:02  | 99      | 91       | 97         | 

For a Single Source

The following works fine if I’m trying to graph the results from just a single source. And as the law of probability would say, the graphed distribution is moreorless in fit with the expected bell curve.

SELECT   source1 AS src1,   COUNT(source1) AS count FROM   `rnddata` WHERE   recorded_at >= "2021-03-11 08:45:00" AND   recorded_at < "2021-03-11 09:45:00" GROUP BY src1 ORDER BY src1 
src1 | count 75   | 1 77   | 2 80   | 2 81   | 5 82   | 6 83   | 20 84   | 10 85   | 14 86   | 31 87   | 33 88   | 48 89   | 74 90   | 74 91   | 89 92   | 107 93   | 133 94   | 135 95   | 168 96   | 160 97   | 192 98   | 190 99   | 195 100  | 189 101  | 197 102  | 191 103  | 188 104  | 180 105  | 201 106  | 130 107  | 128 108  | 107 109  | 96 110  | 64 111  | 65 112  | 45 113  | 40 114  | 19 115  | 22 116  | 18 117  | 9 118  | 8 119  | 6 120  | 3 121  | 4 125  | 1 

For Multiple Sources

I’m thinking that if I can have multiple dimensions (src1, src2… srcN) with a single count column for the metric, then I will be able to graph the dimensions as stacked bars on the X axis and have the count metric set to the X axis.

I imagine the output could be something like this:

src1 | src2 | count 75   | null | 1 77   | 77   | 2 80   | 00   | 2 null | 80   | 5 82   | 82   | 6 83   | null | 20 83   | 11   | null 84   | 84   | 10 

I did a bit of research and experimenting with UNIONS and JOINS and INTERSECTS but couldn’t quiet get the above output. Any advice on how to form such an SQL statement to do that, or offer a better presentation (schema) of the data for the graphing purposes, would be greatly appreciated.

Is the star chart a material component for the Guidance and Guiding Bolt spells from the Circle of Stars druid’s Star Map feature?

The Circle of Stars druid’s Star Map feature grants the following benefits (TCoE, p. 38):

You’ve created a star chart as part of your heavenly studies. It is a Tiny object and can serve as a spellcasting focus for your druid spells. You determine its form by rolling on the Star Map table or by choosing one.

While holding this map, you have these benefits:

  • You know the guidance cantrip.
  • You have the guiding bolt spell prepared. It counts as a druid spell for you, and it doesn’t count against the number of spells you can have prepared.
  • You can cast guiding bolt without expending a spell slot. You can do so a number of times equal to your proficiency bonus, and you regain all expended uses when you finish a long rest.

Neither guiding bolt nor guidance have a material component. It would seem from the language that RAW one must hold the chart in one hand and cast these spells with the other, unless one has the War Caster feat.

Is my interpretation of the rules correct? And what is actually intended?

Is the star chart a material component for guidance and guiding bolt?

Travel Chart for the Forgotten Realms

I’ve got a game set in the Sword Coast and Savage Frontier area of the Forgotten Realms. Is there a book or online resource that I can look at that has travel times between the various locations? For example, I have characters traveling from Waterdeep to Yartar. I’d like to know the road distance and time from Waterdeep to Red Larch, then Red Larch to Triboar, the Triboar to Yartar.

I know that travel times depend on the mode of transportation. Something with the distances is fine. I can extrapolate time from the distance based on walking, riding, etc.

I also know that the big maps have legends that can be used to get distance information. First, I don’t have those maps. I have a bunch of map images on my computer. Many of them chopped into smaller regional maps. Second, a chart of the distances is easier and faster than measuring all the time.

Display `Table` output as a 3D bar chart

Create a simple function with arguments {i,j}, and make a Table for an array of values. For example:

f[i_, j_] := i*j;  data = Table[f[i, j], {i, 1, 25}, {j, 1, 25}] 

I want to create a 3D ‘bar chart’ of data – i.e., a plot that has a column of height f[i, j] at each Cartesian point {i,j} (ideally a block-shaped column with width and depth 1 centred on {i,j}. It sounds dead simple…

But ListPlot3D creates a meshed surface, not a series of columns, and I can’t see an option to change this. And Histogram3D doesn’t accept the format of data, and in any case I can’t get my head around how it generates 3D information from pairs containing only 2 data points each – it’s set up for data sampling, not plotting.


What happens when non-aggravated damage does not fit in the Health Chart?

Suppose my character is wounded (4 damage levels taken). Then, another attack hits for another 4 lethal damage levels. I record damage until Incapacited (3 levels), what I do with the remaining damage level?

I used to assume that the exceeding damage sends you to torpor, but reading the way the text is written I’m not sure any more, at least following RAW.

V20, page 282-283: Incapacited: The stage immediately before torpor, incapacitation differs from unconsciousness in that your character collapses from the combined effects of physical trauma and pain. She falls to the ground and may do nothing except spend blood points to heal damage. Further damage suffered by an incapacitated vampire sends her into torpor or, if the damage is aggravated, inflicts Final Death on her.

The text says further damage sends you to torpor if you are already Incapacitated. In this case seems a bit ambiguous, but later text seems to reinforce me that idea.

V20, page 285: If your character falls to Incapacitated and then takes another level of bashing damage, she enters torpor (p. 283). If your character falls to Incapacitated due to bashing damage but then takes a level of aggravated damage, she meets Final Death

This way the text is written seems to imply you first fall to Incapacitated, and then you receive more damage (from another attack). If this new attack is bashing damage, you fall into torpor; if it’s aggravated, you die.

V20, page 285: When your character’s Health boxes fill to Incapacitated and she takes a further level of lethal damage, she enters torpor (p. 283). If your character is reduced to Incapacitated via lethal damage, and she takes a further level of aggravated damage, she meets Final Death.

This quote seems to imply exceeding damage sends you directly to torpor, but the text is not clear enough to me. That further level of damage can be in the same attack that filled the Incapacitated box, or you had it filled and then received a new attack?

I know in Second Edition exceeding damage is subtracts blood points. I have read several Revised and 20th Anniversary World of Darkness books, but I find similarly ambiguously (at least to me) descriptions.

I must note that I’m not a native English speaker (or reader), if it’s still not obvious to anyone reading me, but I have found the same doubts in the books translations to my language.

The questions are: What happens to exceeding damage that not fit in the Health Chart? Does it sends you to torpor? Is is it discarded?

How to simplify a bar chart with many variables?

I’m a bit stuck here. I need to represent about 40 variables in a bar chart. Each variable needs to be visible… it would be fine if each ended on a different part of the x axis, but unfortunately ~36 of the variables end in the same location. Does anyone have any tips on how to display it more easily/clearly, so that it’s not a giant list of bars at the same length?

Can this AC chart be used in DPR calculations?

Inspired by this, I just processed this list of monsters to get the average AC in monsters, by CR. It comprises all the SRD monsters, I believe.

enter image description here

Can this graph be used in DPR charts?

One way would be to consider the character’s level to match the CR of enemies. So, for example, a level 10 character would calculate its accuracy against an average of 18 AC. With a +7 to hit, it would mean 50% hit chance, so an average damage of 30 per round would equate to 15 average DPR.

If a CR=level matching isn’t adequate, what would be? Can we use standard rules for encounter creation to build such a chart?

Number of data points on stock price chart

We’re creating a graph where customers can see development of security price over time. We’re going to use a line chart with which the user can interact by tap/hold gesture to see different data points and their values on the graph.

Question is – how many data points does it make sense to have on the graph to still have it usable? If we’re talking a data point per week for 5 years that’s 5*52=260 points which seems like a lot for mobile device to interact with (especially on smaller devices like iPhone 5/SE, etc).

However reducing data points makes the graph less granular (which depending on user/use cases might be okay). Any suggestions on how to approach this?

Many thanks!

SPO how to add Organization Chart on communication site?

I would like to know the best organization chart webpart that I could easily install in my Communication site (Modern Experience).

It should be user friendly, with nice theme as well as easily editable. Also it should work with list as well as Active Directory.

Similar to this: Organization Chart

Any suggestion how to achieve it in Modern Experience ?

How to design a chart that has an x-axis with a fixed range that is longer than the selected range?

I’m designing a web-based analytics dashboard that contains a chart in which the x-axis represents the days of a campaign, and it always shows 31 days. However, the duration of a campaign varies; it may be predefined to any period between a single to 31 days.
In cases when the campaign’s duration is shorter than 31 days, I want to make it clear which area of the chart is relevant.
Are there any existing best practice solutions for this scenario?
One idea I have is graying out the area that’s not required (see image below). A bar chart with a 31-days x-axis that shows a 7-days long campaign

The chart’s width is fixed and optimized for displaying a 31-days range. I’m not changing the number of days on the x-axis to avoid scenarios in which there is a single floating dot or bar on the screen or several data points with vast space between them (see images below). A bar chart with a 7-days x-axis that shows a 7-days long campaign A bar chart with a 3-days x-axis that shows a 3-days long campaign