Highcharts: Can I display only part of a series? - highcharts

I have a query regarding display of stock data in highstock.
Firstly:
I want to hide price of last 10 months from a total data of 60 months. I want the months to be displayed (i.e. x-axis should have all 60 months), but want the data to be displayed only for first 50 months.
Secondly:
If an event is triggered (say click) I want these last 10 prices also to be displayed (in additional to the original 50).
Is there a logic/pre-processing in Highcharts/Highstock that can make my implementation efficient such that I do not have to break up my JSON data files?

So you can set serie with 50 points and after click event action, call http://api.highcharts.com/highcharts#Series.addPoint() function (in iteraction) which adds new points missing values.

Related

Google Sheets: Chart: Increase Moving Average Trendline Period

I've set a Trendline for a Chart Series to Moving Average, but the Period only accepts a maximum of 10 periods.
The data is provided as Weekly Stock Prices, using GOOGLEFINANCE(), for the last 10 years.
I would like to see a trendline over a longer period, such as 26 (weeks). Ideally, I would specify this Period in a sheet cell, so I can change it depending on the stock I'm interested in.
One option I thought might work is to add an extra column that works out an average, and use that as another Series? However I don't know how to specify the number of Periods in such a calculated Average().
Is there any method to do this?
I finally found a function that allowed me to create a moving average, and used this for a third column which created another Series in the Chart. It is OFFSET(). This function can define a range which is relative to a specific cell. So the formula n cell C52 is :
OFFSET(B52,-($G$1-1),0,$G$1,1) Gets the range of previous cells for the avg, using cell G1 to vary the period required
AVERAGE(OFFSET(B52,-($G$1-1),0,$G$1,1)) Returns the average
=IFERROR(AVERAGE(OFFSET(B52,-($G$1-1),0,$G$1,1)), "") Error handler as the first (G2-1) cells can't return a range
Cell A2 gets the stock data for the last 10 years using:
=GOOGLEFINANCE(A1, "price", EDATE(TODAY(),-12*$E$1), TODAY(), "WEEKLY")

How do I show data for 4 weeks on a Google Sheets chart by week day?

I want to show data for 4 weeks on a Google Sheets chart.
I have tried to do this and it is mostly ok as this is correct:
The X-axis shows the days of the week
The Y-axis is the weight number
Issues I have with my current implementation are:
I had to make a separate series for each week when I wanted it automatically group the data by week number. (I then can't name each series)
The data is off by one day. Monday's data doesn't show which means Tuesday's data is showing in place of Monday and so on.
Here is a link to the google sheet and a screenshot below: https://docs.google.com/spreadsheets/d/147RMW2JE7MoWz53EZuB-nHj-p_xeKez_ze_0mqq8NGA/edit?usp=sharing
My expected result would look more like this:
Here the lines are shown grouped by each week AND data is shown for each day
The reason why you are missing the first day of every week is that you have checked the Use row 1 as heeaders so every series will remove the first datapoint (monday in your case) and insert it as the label for that series (you can see that in the legend).
If you uncheck that checkbox and change your range for the X-axis so it goes from Monday to Sunday you get the correct graph.
The problem with the previous graph is that although all its datapoints are correct there is no legend. But unfortunately there is no way to insert a legend easily because you cannot go and change this manually, the label for each series has to come from the cells.
What you can do to work around this limitation is change your data so the label for each series sits on top of your data and keep the Use row x as headers checked:
Of course this is not the only solution, you can go on multiple ways here, copy the table in a single sheet for every week, or just live without labels. Stack the weeks horizontally so everyone has its week number on top of the weight column, etc

Highcharts: Display average hour values from a series of quarter-hourly values

My weather station collects every 15 minutes the current temperature. With Highcharts I created a chart to display the last 24h. So I pass all the 96 quarter-hourly values to the chart. This looks not so pretty. Instead I would just display the average of each hour.
Is it possible to display the average value for each hour based on a series of quarter-hourly values and leaving the calculation to Highcharts and not doing it myself?
You can use highstock which allows to use datagrouping.

How to group area chart extremes for x-axis dynamically with day,week,months value in highstock

Need to display area chart in with highstocks for 1 day,1 week,1 month,6 month,1year and 5 years providing the data at once for all the 5 years.But in case of day it is displaying date with time on x-axis which is not required.How can this date be removed as only time is to be displayed (Eg 9 10 11 ....4 5)
Many thanks in advance.
You can use tickPositioner which allows to set tick, dynamically, based on your data and function.
http://api.highcharts.com/highstock#xAxis.tickPositioner

Skip x axis points on highcharts

I am trying to figure out if this can be done with Highcharts. I have 5 different series on my chart and my X axis is made up of Dates. My problem is this, lets say Series 1 has 2 data points 10 and 15 with dates of 5/1/2013 and 5/3/2013. My second Series has Data that is 15 and 20 with dates of 5/1/2013 and 5/4/2013.
What will end up happening is that 5/1/2013 will show up twice and 5/4/2013 wont show up at all.
Now if I remove the duplicate dates, it causes another issue if Series 3 is 5, 10 with 5/3/2013 and 5/4/2013, Instead of the 5 being listed on 5/2/2013 it is showing up on 5/1/2013.
Is there any way around this? or will I have to make different charts for each Series I want listed on there?
Thanks,
Chris

Resources