Set start and end dates for timeline chart

Home Forums SPJS Charts for SharePoint Set start and end dates for timeline chart

Tagged: ,

Viewing 3 reply threads
  • Author
    Posts
    • #21358
      Phil Grant
      Participant

        Hi,
        I have a couple of timeline charts showing similar data but would like to have a common start and end dates on both charts, I found a snippet on stackOverflow that indicates a min/max date can be applied.
        How can I set this up in the SPJS options. I have tried a couple of combinations without success.

        var options = {
          hAxis: {
            minValue: new Date(2018, 1, 1),
            maxValue: new Date(2019, 1, 12)
          }
        };
        • This topic was modified 6 years, 5 months ago by Phil Grant.
      • #21370
        Alexander Bautz
        Keymaster

          Hi,
          You cannot add a date value like this from within the normal configuration UI, but you can add a script editor web part to the page with this code:

          <script type="text/javascript">
          var spjs_chart_option_override = {
              hAxis: {
                  minValue: new Date(2018, 1, 1),
                  maxValue: new Date(2019, 1, 12)
              }
          };
          </script>

          This will add these options to all the charts in the current page.

          Hope this helps.

          Alexander

        • #21383
          Phil Grant
          Participant

            Great, thanks I’ll give that a try on Monday.

          • #21419
            Phil Grant
            Participant

              Thanks Alexander that worked fine

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.