从Array数据创建图表,而不是范围 [英] Create Chart from Array data and not range

查看:90
本文介绍了从Array数据创建图表,而不是范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有可能创造一个图表(例如双Y轴折线图)不是从范围,但经过阵列数据?如果是这样,怎么样?

is it possible to create a Chart (e.g. Double Y-Axis Line Chart) not from Ranges, but from Array data? If so, how?

推荐答案

是的。您可以将阵列添加到 XValues​​ A 系列在图表上对象。例如:

Yes. You can assign arrays to the XValues and Values properties of a Series object on a chart. Example:

Dim c As Chart
Dim s As Series
Dim myData As Variant

Set c = ActiveChart ' Assumes a chart is currently active in Excel...
Set s = c.SeriesCollection(1)

myData = Array(9, 6, 7, 1) ' or whatever
s.Values = myData

这篇关于从Array数据创建图表,而不是范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆