---
title: "AnyChart图表控件使用指南(四)"
author: "lovojry"
date: "2011-10-12T13:41:25Z"
tags: []
categories: ["Web前端"]
slug: "anychart"
draft: false
lastmod: "2011-10-12T13:41:25Z"
id: 1190602
url: "https://lovojry.iteye.com/blog/1190602"
---

AnyChart是基于XML数据输入，但是仍然可以使用JavaScrpit函数对图表进行数据操作，创建交互式的图表应用程序。AnyChart提供了很多JavaScrpit函数可进行添加、修改、删除数据点以及数据序列，进行数据点和数据序列高亮显示，选择和取消选择数据点和数据序列，使用这些函数就可以对图表进行运行时编辑。

[关于产品的详细介绍和更多使用方法请查看&gt;&gt;](https://www.componentcn.com/html/jbtbkj_249_5209.html)

1.    用于数据序列的函数，见下表

**方法**

**参数**

**描述**

AddSeries(seriesNode1, ...)

seriesNode1: String  
seriesNode2: String  
...

该方法用于添加数据序列，其中seriesNode1和seriesNode2等是数据序列的数据点

RemoveSeries(seriesId)

seriesId: String

该方法用于根据数据序列ID删除某一条数据序列

AddSeriesAt(index, seriesNode):void

index: Number  
seriesNode: String

该方法用于在指定的索引位置添加数据序列

UpdateSeries(seriesId, seriesNode):void

seriesId: String  
seriesNode: String

根据数据序列ID更新数据序列数据点

ShowSeries(seriesId, isVisible)

seriesId: String  
isVisible: Boolean

根据数据序列ID显示或隐藏数据序列

 

这些函数的具体使用，请查看[在线事例](http://www.anychart.com/products/anychart/docs/users-guide/livesamples/js-series/index.html)

 

2.    关于操作数据点的函数，请查看下表：

方法 参数 描述 AddPoint(seriesId, pointNode, ...) seriesId: String  
pointNode1: String  
pointNode2: String  
...  
  为指定的数据序列添加数据点 RemovePoint(seriesId, pointId):void seriesId: String  
pointId: String 删除指定数据序列的某个数据点 AddPointAt(seriesId, index, pointNode) seriesId: String  
index: Number  
pointNode: String 添加数据点到数据序列的指定位置 UpdatePoint(seriesId, pointId, pointNode) seriesId: String  
pointId: String  
pointNode: String 改变某个数据点的值 UpdatePointWithAnymation(seriesId, pointId, newValue,animationSettings) seriesId: String  
pointId: String  
newValue: Object  
animationSettings: Object 改变某个数据点的值，附带动画效果

添加、删除、更新数据点请查看[在线事例](http://www.anychart.com/products/anychart/docs/users-guide/livesamples/js-points/index.html)

动画更新数据点，请查看[在线事例](http://www.anychart.com/products/anychart/docs/users-guide/livesamples/point-update-with-animation/anychart.html)

 

3.    高亮、选择和取消选择函数，请查看下表：

 

**方法**

**参数**

**描述**

HighlightSeries(seriesId, highlighted)

seriesId: String  
highlighted: Boolean

对某条数据序列高亮或者取消高亮显示

HighlightPoint(seriesId, pointId, highlighted)

seriesId: String  
pointId: String  
highligthed: Boolean

对某个数据点高亮或者取消高亮显示

HighlightCategory(categoryName, highlighted)

categoryName: String  
highlighted: Boolean

对某类数据序列高亮或者取消高亮显示

SelectPoint(seriesId, pointId, selected)

seriesId: String  
pointId: String  
selected: Boolean

选择或者取消选择数据点

 

具体用法，请查看[在线事例](http://www.anychart.com/products/anychart/docs/users-guide/livesamples/js-interactivity/index.html)

 

4.    控件还提供了Refresh()函数，在任何时候使用上面提到的函数改变图表序列或者数据点时，最后一定要使用Refresh()函数来使改变生效。

5.    AnyChart还提供了许多交互功能，我们在以后还会逐步介绍，如项目中需要该控件您可以[下载试用版](http://www.componentcn.com/html/jbtbkj_249_5209.html)测试。