• Demos
    • JavaScript Charts
    • JavaScript StockCharts
  • Download/NPM
    • Download CanvasJS
    • Install via NPM
  • Integrations
    Front End Technology Samples
    • React Charts
    • Angular Charts
    • Vue.js Charts New!
    • jQuery Charts
    • Dashboards
    Server Side Technology Samples
    • PHP Charts
    • Python Charts New!
    • ASP.NET MVC Charts
    • Spring MVC Charts
    • JSP Charts
  • License
  • Blog
  • Docs
    • Chart Documentation
    • StockChart Documentation
  • Support Forum
    • Chart Support
    • StockChart Support
  • My Account
My Account
  • KEY FEATURES
    • Chart with Index / Data Label
    • Chart with Zooming & Panning
    • Multi Series Chart
    • Chart with Multiple Axes
    • Combination Charts
    • Chart with Animation
    • Chart with Logarithmic Axis
    • Dynamic Chart
    • Chart with Data from AJAX
    • Drilldown Chart
    • Responsive Chart
    • Synchronized Charts
  • LINE CHARTS
    • Line Chart with Date-Time Axis
    • Dashed Line Chart
    • Multi Series Line Chart
    • Spline Chart
    • Multi Series Spline Chart
    • Step Line Chart
    • Multi Series Step Line Chart
  • BAR CHARTS
    • Bar Chart with Category Axis
    • Multi Series Bar Chart
    • Stacked Bar Chart
    • Stacked Bar 100% Chart
    • Stacked Bar 100% Chart with Indexlabels
  • COLUMN CHARTS
    • Column Chart with Numeric Axis
    • Multi Series Column Chart
    • Stacked Column Chart
    • Stacked Column 100% Chart
    • Stacked Column 100% Chart with Indexlabel
    • Waterfall Chart
    • Waterfall Chart with Indexlabels
    • Multi Series Waterfall Chart
  • PIE & DOUGHNUT CHARTS
    • Pie Chart with Index Labels
    • Pie Chart in Dark Theme
    • Doughnut Chart with Index Labels
    • Doughnut Chart in Dark Theme
  • AREA CHARTS
    • Area Chart with Indexlabels
    • Multi Series Area Chart
    • Spline Area Chart
    • Multi Series Spline Area Chart
    • Step Area Chart
    • Stacked Area Chart
    • Stacked Area 100% Chart
  • RANGE CHARTS
    • Range Column Chart
    • Multi Series Range Column Chart
    • Range Bar Chart
    • Multi Series Range Bar Chart
    • Range Area Chart
    • Multi Series Range Area Chart
    • Range Spline Area Chart
    • Multi Series Range Spline Area Chart
  • BUBBLE & SCATTER CHARTS
    • Bubble Chart with Indexlabels
    • Bubble Chart with 3 Dimensional Data
    • Multi Series Scatter Chart
  • FUNNEL & PYRAMID CHARTS
    • Funnel Chart with Index Labels
    • Funnel Chart without Neck
    • Pyramid Chart with Index Labels
  • FINANCIAL CHARTS
    • Candlestick Chart
    • Multi Series Candlestick Chart
    • OHLC Chart
    • OHLC Chart from JSON data
    • Box & Whisker Chart
  • COMBINATION CHARTS
    • Error Bar Chart
    • Pareto Chart
    • Range Area & Line Chart
    • Candlestick & Line Chart
    • OHLC Chart with Trend
  • DYNAMIC CHARTS
    • Dynamic / Live Line Chart
    • Dynamic / Live Column Chart
    • Dynamic / Live Multi Series Chart
  • STOCKCHARTS
    • StockChart with Numeric Axis
    • StockChart with Date-Time Axis
    • StockChart with Navigator & Range Selector
  • JAVASCRIPT, REACT, VUE.JS, JQUERY
    • JavaScript Charts
    • React Charts
    • Vue.js Charts
    • jQuery Charts
  • SERVER SIDE TECHNOLOGIES
    • ASP.NET MVC Charts
    • JSP Charts
    • PHP Charts
    • Python Charts
    • Spring MVC Charts

Angular Stacked Area Chart

Download Angular Chart Samples
  • Angular Chart Samples
  • JavaScript Chart Samples
  • React Chart Samples
  • Vue.js Chart Samples
  • jQuery Chart Samples
  • PHP Chart Samples
  • Python Django Chart Samples
  • ASP.NET Chart Samples
  • JSP Chart Samples
  • Spring MVC Chart Samples
  • Dashboard Samples
  • JavaScript StockChart Samples

Example shows Angular Stacked Area Chart that is formed by stacking multiple dataseries one on top of the other.

  • Component Code
  • HTML Code
/* app.component.ts */
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { CommonModule } from '@angular/common';
import { CanvasJSAngularChartsModule } from '@canvasjs/angular-charts';

@Component({
    selector: 'app-root',
    standalone: true,
    imports: [RouterOutlet, CommonModule, CanvasJSAngularChartsModule],
    templateUrl: './app.component.html',
    styleUrl: './app.component.css',
})
export class AppComponent {
    chartOptions = {
        title: {
            text: "Productivity by Day"
        },
        animationEnabled: true,
        axisX: {
            valueFormatString: "DDD"
        },
        toolTip: {
            shared: true,
            contentFormatter: function (e: any) {
                var weekday = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
                var content = weekday[e.entries[0].dataPoint.x.getDay()] + "<br/>";
                for (var i = e.entries.length - 1; i >= 0; i--) {
                    content += "<span style ='color:" + e.entries[i].dataSeries.color + "; font-weight: bold;';>" + e.entries[i].dataSeries.name + "</span>:" + e.entries[i].dataPoint.y + "hrs";
                    content += "<br/>";
                }
                return content;
            }
        },
        legend: {
            cursor: "pointer",
            itemclick: function (e: any) {
                if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
                    e.dataSeries.visible = false;
                }
                else {
                    e.dataSeries.visible = true;
                }
                e.chart.render();
            }
        },
        data: [{
            type: "stackedArea",
            name: "Very Distracting",
            showInLegend: true,
            legendMarkerType: "square",
            color: "rgba(211,19,14,.9)",
            markerSize: 0,
            dataPoints: [
                { x: new Date(2020, 2, 15), y: 2.4 },
                { x: new Date(2020, 2, 16), y: .6 },
                { x: new Date(2020, 2, 17), y: .8 },
                { x: new Date(2020, 2, 18), y: 1.6 },
                { x: new Date(2020, 2, 19), y: 1.4 },
                { x: new Date(2020, 2, 20), y: 1.4 },
                { x: new Date(2020, 2, 21), y: 2.6 }
            ]
        },
        {
            type: "stackedArea",
            name: "Distracting",
            showInLegend: true,
            legendMarkerType: "square",
            markerSize: 0,
            color: "rgba(95,53,87,.9)",
            dataPoints: [
                { x: new Date(2020, 2, 15), y: 3.3 },
                { x: new Date(2020, 2, 16), y: 1.6 },
                { x: new Date(2020, 2, 17), y: 2.1 },
                { x: new Date(2020, 2, 18), y: 1.6 },
                { x: new Date(2020, 2, 19), y: 1.4 },
                { x: new Date(2020, 2, 20), y: 1.7 },
                { x: new Date(2020, 2, 21), y: 4.6 }
            ]
        },
        {
            type: "stackedArea",
            name: "Productive",
            showInLegend: true,
            legendMarkerType: "square",
            markerSize: 0,
            color: "rgba(60,84,151,.9)",
            dataPoints: [
                { x: new Date(2020, 2, 15), y: 2.4 },
                { x: new Date(2020, 2, 16), y: 2 },
                { x: new Date(2020, 2, 17), y: 2.8 },
                { x: new Date(2020, 2, 18), y: 1.6 },
                { x: new Date(2020, 2, 19), y: 1.4 },
                { x: new Date(2020, 2, 20), y: 1.4 },
                { x: new Date(2020, 2, 21), y: 1.6 }
            ]
        },
        {
            legendMarkerType: "square",
            name: "Very Productive",
            showInLegend: true,
            type: "stackedArea",
            markerSize: 0,
            color: "rgba(22,115,211,.9)",
            dataPoints: [
                { x: new Date(2020, 2, 15), y: .4 },
                { x: new Date(2020, 2, 16), y: 7 },
                { x: new Date(2020, 2, 17), y: 6.8 },
                { x: new Date(2020, 2, 18), y: 4.6 },
                { x: new Date(2020, 2, 19), y: 6.4 },
                { x: new Date(2020, 2, 20), y: 7.4 },
                { x: new Date(2020, 2, 21), y: 1.6 }
            ]
        }]
    }
}                              
<div>
    <canvasjs-chart [options]="chartOptions" [styles]="{width: '100%', height:'360px'}"></canvasjs-chart>    
</div>                        

Chart Customizations

In the above example, tooltip content has been customized with the help of contentFormatter. Dataseries can be shown / hidden by clicking the legend. Some other customizations include showInLegend, shared tooltip, etc.

Note   For step by step instructions, follow our Angular Integration Tutorial

Quick Links

  • Chart Docs
  • StockChart Docs
  • About Us
  • FAQs

Server Side Technologies

  • ASP.NET MVC Charts
  • PHP Charts
  • JSP Charts
  • Spring MVC Charts

Front Side Technologies

  • JavaScript Charts
  • jQuery Charts
  • React Charts
  • Angular Charts
  • JavaScript StockCharts

Contact

  • Fenopix, Inc.
  • 2093 Philadelphia Pike,
  • #5678, Claymont,
  • Delaware 19703
  • United States Of America

©2025 Fenopix Privacy Policy Cookies Policy Careers