angularhighchartsangular-highcharts

Angular cannot using Highcharts X-range series


I created a project with Angular framework and used Highcharts X-range but I can't do it by attaching Error as shown in the picture... enter image description here

HTML: enter image description here

typescript: enter image description here

please someone who knows tell me how to fix it. Many thanks,


Solution

  • For loading xrange series you need to load module xrange.

    import Xrange from 'highcharts/modules/xrange';
    Xrange(Highcharts);
    

    The partialFill it's not correct with object, you can see how they look at the API documentation data.partialFill.amount.

      data: [{
        x: Date.UTC(2014, 10, 21),
        x2: Date.UTC(2014, 11, 2),
        y: 0,
        partialFill: {
          amount: 0.5
        }
      }, {
        x: Date.UTC(2014, 11, 2),
        x2: Date.UTC(2014, 11, 5),
        y: 1
      }, {
        x: Date.UTC(2014, 11, 8),
        x2: Date.UTC(2014, 11, 9),
        y: 2
      }, {
        x: Date.UTC(2014, 11, 9),
        x2: Date.UTC(2014, 11, 19),
        y: 1
      }, {
        x: Date.UTC(2014, 11, 10),
        x2: Date.UTC(2014, 11, 23),
        y: 2
      }],
    

    Demo: https://stackblitz.com/edit/highcharts-angular-basic-line-7km3p6?file=src%2Fapp%2Fapp.component.ts

    API: https://api.highcharts.com/highcharts/series.xrange.data.partialFill