search
HomeWeb Front-endJS TutorialHow to use highcharts in angular
How to use highcharts in angularFeb 07, 2018 pm 02:10 PM
angularhighchartsInstructions

This article mainly introduces the sample code for using highcharts in angular. It is of great practical value. Friends in need can refer to it. I hope it can help everyone.

Installing dependencies


##

npm install highcharts-ng --save

Introducing dependencies


##

'highcharts/highcharts.src.js',
'highcharts-ng/dist/highcharts-ng.min.js'

Inject dependencies


var myapp = angular.module('myapp', ["highcharts-ng"]);

Instance


##
// html
<highchart class="chart" config="chartConfig" class="span9" ></highchart>

// js
$scope.chartConfig = {
 title: {
   text: &#39;哈哈哈&#39;,
   x: -20
 },
 subtitle: {
  text: &#39;Click and drag to zoom in.&#39;,
  x: -20
 },
 xAxis: {
  categories: [&#39;一月&#39;, &#39;二月&#39;, &#39;三月&#39;, &#39;四月&#39;, &#39;五月&#39;, &#39;六月&#39;, &#39;七月&#39;, &#39;八月&#39;, &#39;九月&#39;, &#39;十月&#39;, &#39;十一月&#39;, &#39;十二月&#39;]
 },
 yAxis: {
  title: {
   text: &#39;温度 (°C)&#39;
  },
  plotLines: [{
   value: 0,
   width: 1,
   color: &#39;#808080&#39;
  }]
 },
 tooltip: {
  valueSuffix: &#39;°C&#39;
 },
 legend: {
  layout: &#39;vertical&#39;,
  align: &#39;right&#39;,
  verticalAlign: &#39;middle&#39;,
  borderWidth: 0
 },
 series: [{
  name: &#39;东京&#39;,
  data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
 }, {
  name: &#39;纽约&#39;,
  data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
 }, {
  name: &#39;柏林&#39;,
  data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
 }, {
  name: &#39;伦敦&#39;,
  data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
 }]
};

Result

Basic composition of Highcharts

Related recommendations:


Sharing of value transfer and communication methods between different components in angular

Examples share some experience of using ui calendar in angular

How to obtain built-in services and obtain local information in angular

The above is the detailed content of How to use highcharts in angular. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
聊聊Angular中的元数据(Metadata)和装饰器(Decorator)聊聊Angular中的元数据(Metadata)和装饰器(Decorator)Feb 28, 2022 am 11:10 AM

本篇文章继续Angular的学习,带大家了解一下Angular中的元数据和装饰器,简单了解一下他们的用法,希望对大家有所帮助!

如何在Highcharts中使用动态数据来展示实时数据如何在Highcharts中使用动态数据来展示实时数据Dec 17, 2023 pm 06:57 PM

如何在Highcharts中使用动态数据来展示实时数据随着大数据时代的到来,对于实时数据的展示变得越来越重要。Highcharts作为一种流行的图表库,提供了丰富的功能和可定制性,使得我们可以灵活地展示实时数据。本文将介绍如何在Highcharts中使用动态数据来展示实时数据,并给出具体的代码示例。首先,我们需要准备一个能够提供实时数据的数据源。在本文中,我

如何在Highcharts中使用桑基图来展示数据如何在Highcharts中使用桑基图来展示数据Dec 17, 2023 pm 04:41 PM

如何在Highcharts中使用桑基图来展示数据桑基图(SankeyDiagram)是一种用于可视化流量、能源、资金等复杂流程的图表类型。它能清晰展示各个节点之间的关系和流动情况,可以帮助我们更好地理解和分析数据。在本文中,我们将介绍如何使用Highcharts来创建和定制一个桑基图,并附上具体的代码示例。首先,我们需要加载Highcharts库和Sank

Angular + NG-ZORRO快速开发一个后台系统Angular + NG-ZORRO快速开发一个后台系统Apr 21, 2022 am 10:45 AM

本篇文章给大家分享一个Angular实战,了解一下angualr 结合 ng-zorro 如何快速开发一个后台系统,希望对大家有所帮助!

如何在Highcharts中使用堆叠图表来展示数据如何在Highcharts中使用堆叠图表来展示数据Dec 18, 2023 pm 05:56 PM

如何在Highcharts中使用堆叠图表来展示数据堆叠图表是一种常见的数据可视化方式,它可以同时展示多个数据系列的总和,并以柱状图的形式显示每个数据系列的贡献。Highcharts是一款功能强大的JavaScript库,提供了丰富的图表种类和灵活的配置选项,可以满足各种数据可视化的需求。在本文中,我们将介绍如何使用Highcharts来创建一个堆叠图表,并提

如何使用Highcharts创建甘特图表如何使用Highcharts创建甘特图表Dec 17, 2023 pm 07:23 PM

如何使用Highcharts创建甘特图表,需要具体代码示例引言:甘特图是一种常用于展示项目进度和时间管理的图表形式,能够直观地展示任务的开始时间、结束时间和进度。Highcharts是一款功能强大的JavaScript图表库,提供了丰富的图表类型和灵活的配置选项。本文将介绍如何使用Highcharts创建甘特图表,并给出具体的代码示例。一、Highchart

如何使用Highcharts创建地图热力图如何使用Highcharts创建地图热力图Dec 17, 2023 pm 04:06 PM

如何使用Highcharts创建地图热力图,需要具体代码示例热力图是一种可视化的数据展示方式,能够通过不同颜色深浅来表示各个区域的数据分布情况。在数据可视化领域,Highcharts是一个非常受欢迎的JavaScript库,它提供了丰富的图表类型和交互功能。本文将介绍如何使用Highcharts创建地图热力图,并提供具体的代码示例。首先,我们需要准备一些数据

如何利用Highcharts创建自定义图表如何利用Highcharts创建自定义图表Dec 17, 2023 pm 10:39 PM

如何利用Highcharts创建自定义图表Highcharts是一个功能强大且易于使用的JavaScript图表库,它可以帮助开发人员创建各种类型的交互式和可定制化的图表。为了利用Highcharts创建自定义图表,我们需要掌握一些基本概念和技术。本文将介绍一些重要的步骤,并提供具体的代码示例。步骤一:引入Highcharts库首先,我们需要在HTML文件中

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.