Highcharts moving average based on visible data only - ruby-on-rails

So, I have a price time series I wrote a moving average for the prices of different retailers http://i.imgur.com/dn3EdM6.png . So far so good, but I want to only see the moving average of the visible retailers. For example, here I have only one shop shown, but the moving average is calculated on all of them. http://i.imgur.com/ZpK5gsG.png Is it possible to make it to dynamically change? Maybe reload the graph or something?

I made an example based on my comment above.
This example does not calculate a moving average - I wrote a simple function to calculate the overall average for the sake of simplicity.
The purpose of the example is to demonstrate how to do it on legendItemClick, making use of only the visible series.
Example:
http://jsfiddle.net/jlbriggs/gejgquxh/

Related

Tableau - Data disappear when changing 'date'

Working some data and needing to essentially do an 'average' of an 'average'. Have a daily snapshot that I am averaging over the month, then want to sum the averages and then find the average of that. I know I know, boss says it's a requirement.
So the data looks fine when I have 'Year/Month' on the rows shelf. The issue I am running into is that when I remove the 'month' pill, the data disappears. I've narrowed it down to my calc and the part where I'm trying to define how to average at the lower level.
Any ideas if there is a way to calc it at that lower level to use in the second part where I need to sum those averages then average that?
Tableau Calc
Table

Tableau map tooltip not displaying average reference line

I created a chart visualising the cost of living in different cities and entered a line indicating the average. When integrating this sheet into the tooltip of my map, the line is not representing the average anymore but the actual cost of living for each city. I have been trying a lot but can't seem to figure it out. Thankful for any tip!
That's because the tooltip, triggered by the click/hover, is taking into consideration just a city at once, and so the average value is equal to the sum of that specific city: you're running average on just one city.
In order to compute the correct reference value you should create a calculated field like this using LOD:
{ FIXED : SUM([Cost Of Living])} / { FIXED : COUNTD([City])}
Then you could use that calculated field in a dual axis chart.
Doing so, since EXCLUDE acts before dimension filters, you will be able to preserve your average across City even though tooltip will trigger a filter.
Take a look at this simple example made with superstore and keep and eye on the red line (LOD v2) which relates to the calulated field above.
As you can see there's also a blue line which relates to the previous calculated field I wrote (LOD v1):
{ EXCLUDE [State] : AVG( { FIXED [State] : SUM([Sales])})}
Once we move to our main worksheet triggering the viz in tooltip, you'll see that the red value still keep the correct value calculated on all data, while the blue value is taking into consideration just data according to filter.
In fact FIXED is the only LOD calculus which act before the dimension filters and it's able to bypass the filtering triggered by the tooltip.

sumif function in excel to display percentage based on text

I am attempting to display a progress percentage in a single cell based on the choice of "completion" from a data validation list that spans multiple columns and cells.
I have attached a screen grab that will hopefully better explain. I would like the "Overall status cell (B3) to display the percentage of "Completes" that will track overall progress of requirements.
I have narrowed to a "sumif" function based on research and former templates but cannot achieve the desired result. Any help would be excellent. Thank you in advance.
You would want to do a =(COUNTIF(C5:C100, "Completed")/COUNTA(C5:C100)).
Obviously, you might want to change the range.
E2A: =SUMIF adds numbers together. Because you're looking at Text, you'll want to do a =COUNTIF and =COUNTA.

Highcharts compare different dates ranges

I'd like to use highstock to compare two different time ranges together.
For example, for two data sets, one that shows the max temp for each day in Jan and the other one for Feb (for example), I'd like them to be shown one above the other, with the x-axis being the "same" one for both.
I can't do it with categories, because the data is being fed automatically, so each data point has its own time, so the x-axis is datetime.
I wanted to know if it was possible to simply have two graphs overlapping, with one graph having the normal x-axis at the bottom, and the other one having on top of the graph, so even when the data is for different times, it's shown overlapping. I can't find this problem anywhere.
Found the answer on this thread. Hope it helps!
Overlay 2 series of data of different length with highcharts
Essential Chart can be used with different date ranges with multiple axes. example source
The community license provides the whole suite of products for free if you qualify.
Note: I work for Syncfusion.

Drilldown line highcharts?

I am working on line chart. I am sending two sets of data. Both are date,value pair. One set is of average and another is for daily readings. I need to make it drill down so that when I click on the average it will take me to all the readings of the day. The data is dynamic. Can anyone please help me how to approach with this ?

Resources