Highcharts 简明教程

Highcharts - Environment Setup

在本教程中,我们将讨论如何设置 Highcharts 库以用于 Web 应用程序开发。

In this chapter, we will discuss how to set up the Highcharts library to be used in web application development.

Highcharts 需要把 jQuery 作为依赖。首先,我们将安装 jQuery 库,然后安装 Highcharts 库。

Highcharts requires jQuery as a dependency. First, we will install the jQuery library and then the Highcharts library.

Install jQuery

有两种方法可以使用 jQuery。

There are two ways to use jQuery.

  1. Download − Download it locally from jQuery.com and use it.

  2. CDN access − You also have access to a CDN. The CDN will give you access around the world to regional data centers; in this case, Google host. This means using CDN moves the responsibility of hosting files from your own servers to a series of external ones. This also offers an advantage that if the visitor to your webpage has already downloaded a copy of jQuery from the same CDN, it will not have to be re-downloaded.

Using Downloaded jQuery

使用以下脚本来在 HTML 页面中包含 jQuery JavaScript 文件 −

Include the jQuery JavaScript file in the HTML page using the following script −

<head>
   <script src = "/jquery/jquery.min.js"></script>
</head>

Using CDN

使用以下脚本来在 HTML 页面中包含 jQuery JavaScript 文件 −

Include the jQuery JavaScript file in the HTML page using the following script −

<head>
   <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
   </script>
</head>

Install Highcharts

以下是使用 Highcharts 的两种方法。

The following are the two ways to use Highcharts.

  1. Download − Download it locally from highcharts.com and use it.

  2. CDN access − You also have access to a CDN. The CDN will give you access around the world to regional data centers; in this case, the Highcharts host - Code.Highcharts.Com.

Using Downloaded Highcharts

使用以下脚本来在 HTML 页面中包含 Highcharts JavaScript 文件 −

Include the Highcharts JavaScript file in the HTML page using the following script −

<head>
   <script src = "/highcharts/highcharts.js"></script>
</head>

Using CDN

使用以下脚本来在 HTML 页面中包含 Highcharts JavaScript 文件 −

Include the Highcharts JavaScript file in the HTML page using the following script −

<head>
   <script src = "https://code.highcharts.com/highcharts.js"></script>
</head>