Jump to content
  • 0
Sign in to follow this  
gregbovenkerk

Show Records by Week in Chart

Question

1 answer to this question

Recommended Posts

  • 0

Hello @gregbovenkerk!

You may use the JS code to update the chart with custom Values for each week number of the year.
I have found one web site to get the values for each week number - https://www.epochconverter.com/weeks/2020
Obviously, you will need to update the Array of custom values each year, but it works perfectly!

See the example of the code:

<script type="text/javascript">

var myVar = setInterval(myTimer, 1000);

function myTimer() {
 if(Highcharts) {
  const customMonths = [
    'December 30, 2019',
    'January 6, 2020',
    'January 13, 2020',
    'January 20, 2020',
    'January 27, 2020',
    'February 3, 2020',
    'February 10, 2020',
    'February 17, 2020',
    'February 24, 2020',
    'March 2, 2020',
    'March 9, 2020',
    'March 16, 2020',
    'March 23, 2020',
    'March 30, 2020',
    'April 6, 2020',
    'April 13, 2020',
    'April 20, 2020',
    'April 27, 2020',
    'May 4, 2020',
    'May 11, 2020',
    'May 18, 2020',
    'May 25, 2020',
    'June 1, 2020',
    'June 8, 2020',
    'June 15, 2020',
    'June 22, 2020',
    'June 29, 2020',
    'July 6, 2020',
    'July 13, 2020',
    'July 20, 2020',
    'July 27, 2020',
    'August 3, 2020',
    'August 10, 2020',
    'August 17, 2020',
    'August 24, 2020',
    'August 31, 2020',
    'September 7, 2020',
    'September 14, 2020',
    'September 21, 2020',
    'September 28, 2020',
    'October 5, 2020',
    'October 12, 2020',
    'October 19, 2020',
    'October 26, 2020',
    'November 2, 2020',
    'November 9, 2020',
    'November 16, 2020',
    'November 23, 2020',
    'November 30, 2020',
    'December 7, 2020',
    'December 14, 2020',
    'December 21, 2020',
    'December 28, 2020'
  ];

   Highcharts.charts[0].update({
     xAxis: {
       categories: customMonths
     }
   }); 

  myStopFunction();
 }
 return null;
}

function myStopFunction() {
  clearInterval(myVar);
}

</script>

You should insert this code into the header of the Chart page. Do not forget to disable the HTML editor before you insert the code!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...