New to Kendo UI for jQueryStart a free 30-day trial

Series.trendline

configuration

The trendline configuration options.

The trendline option is supported when series.type is set to "linearTrendline", "exponentialTrendline", "logarithmicTrendline", "powerTrendline", "polynomialTrendline" or "movingAverageTrendline".

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  dataSource: {
    data: [
      {
          period: "2021 Q1",
          count: 669590.0
      },
      {
          period: "2021 Q2",
          count: 793564.0
      },
      {
          period: "2021 Q3",
          count: 941133.0
      },
      {
          period: "2021 Q4",
          count: 1133020.0
      }
    ]
  },
  series: [{
    name: "Sales By Quarter",
    type: "line",
    field: "count",
    categoryField: "period"
  }, {
    name: "Average",
    type: "movingAverageTrendline",
    for: "Sales By Quarter",
    trendline: {
      period: 3
    }
  }]
});
</script>

The trendline forecast settings. By default, the trendline does not display a forecast.

The forecast option is supported when series.type is set to "linearTrendline", "exponentialTrendline", "logarithmicTrendline" or "powerTrendline" and the parent series are either Date Series, "scatter" or "scatterLine" series.

  <div id="chart"></div>
<script>
$("#chart").kendoChart({
  dataSource: {
    data: [
      {
          period: "2021 Q1",
          date: new Date(2021, 0, 1),
          count: 669590.0
      },
      {
          period: "2021 Q2",
          date: new Date(2021, 3, 1),
          count: 793564.0
      },
      {
          period: "2021 Q3",
          date: new Date(2021, 6, 1),
          count: 941133.0
      },
      {
          period: "2021 Q4",
          date: new Date(2021, 9, 1),
          count: 1133020.0
      }
    ]
  },
  series: [{
    name: "Sales By Quarter",
    type: "line",
    field: "count",
    categoryField: "date"
  }, {
    name: "Sales Trend",
    type: "linearTrendline",
    for: "Sales By Quarter",
    trendline: {
      forecast: {
        before: 3,
        after: 5
      }
    }
  }]
});
</script>

The order (degree) of the Polynomial trendline. The default value is 2.

The period setting is supported only when series.type is set to "polynomialTrendline".

Accepted values are from 2 to 6:

  • 2: a Quadratic polynomial trendline with a single extreme point (minimum or maximum) point.
  • 3: a Cubic polynomial trendline with up to 2 extreme points.
  • 4: a polynomial trendline of 4th degree with up to 3 extreme points.
  • 5: a polynomial trendline of 5th degree with up to 4 extreme points.
  • 6: a polynomial trendline of 6th degree with up to 5 extreme points.

Default: 2

<div id="chart"></div>
<script>
$("#chart").kendoChart({
    dataSource: {
        data: [
        {
            period: "2021 Q1",
            count: 369590.0
        },
        {
            period: "2021 Q2",
            count: 793564.0
        },
        {
            period: "2021 Q3",
            count: 1441133.0
        },
        {
            period: "2021 Q4",
            count: 1233020.0
        }
        ]
    },
    series: [{
        name: "Sales By Quarter",
        type: "line",
        field: "count",
        categoryField: "period"
    }, {
        name: "Sales Trend",
        type: "polynomialTrendline",
        for: "Sales By Quarter",
        trendline: {
            order: 3
        }
    }]
});
</script>

The number of intervals to take when calculating averages. The value should be an integer greater than 2.

The period setting is supported only when series.type is set to "movingAverageTrendline".

Default: 2

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  dataSource: {
    data: [
      {
          period: "2021 Q1",
          count: 669590.0
      },
      {
          period: "2021 Q2",
          count: 793564.0
      },
      {
          period: "2021 Q3",
          count: 941133.0
      },
      {
          period: "2021 Q4",
          count: 1133020.0
      }
    ]
  },
  series: [{
    name: "Sales By Quarter",
    type: "line",
    field: "count",
    categoryField: "period"
  }, {
    name: "Sales Trend",
    type: "movingAverageTrendline",
    for: "Sales By Quarter",
    trendline: {
      period: 3
    }
  }]
});
</script>