excel图表怎么创建动画商业图表
时间:2023-03-25 06:42:18
本文主要介绍如何将动画应用于商业图表,如下图1所示。
图1
制作图表的示例数据如下图2所示的工作表:
图2
在工作表中放置几个表单控件并设置相应的格式,如图3所示。
图3
其中,“下拉框”控件的控件格式设置如图3,数据源区域为图2所示工作表的单元格区域A43:A46,所选值链接到单元格B37。
下面的3个选项按钮链接到名为“chart_type”的单元格。
最后的“开启动画”复选框链接到名为“b_animation”的单元格;“开启擦除”复选框链接到名为“b_easing”的单元格。
如图4所示,在单元格区域B33:B39中放置图3中的控件值、设置图表动画的步骤以及图表标题。单元格区域D33:D39中为列B中对应单元格所定义的名称。
图4
其中,单元格B39所定义的名称为一个命名公式:
=INDEX($A$43:$A$46,record_index)
图5列出了工作簿中所有定义的名称:
图5
其中,old和switch_to_record是在运行VBA代码时添加的。
VBA代码如下:
PrivatebFinished As Boolean
PublicSub AnimateChart()
Dim i As Integer
bFinished = False
ThisWorkbook.Names.Add “old”,[chart_values]
ThisWorkbook.Names.Add”switch_to_record”, [record_index].Value
If [b_animation] Then
For i = 1 To [animation_steps]
[step] = i
DoEvents
If bFinished Then Exit For
Next i
End If
bFinished = True
EndSub
PublicSub ChangeChartType()
Const CHART_TYPE_COLUMN = 1
Const CHART_TYPE_LINE = 2
Const CHART_TYPE_AREA = 3
WithWorksheets(“demo”).ChartObjects(1).Chart
Select Case [chart_type]
Case CHART_TYPE_COLUMN
.ChartType = xlColumnClustered
Case CHART_TYPE_LINE
.ChartType = xlLineMarkers
Case CHART_TYPE_AREA
.ChartType = xlArea
End Select
End With
EndSub
其中,ChangeChartType过程关联到选项按钮,用于更改图表类型;AnimateChart过程关联到下拉框,用于实现选择不同数据时的图表动画效果。
最后的效果如下图6所示。
图6
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
excel怎么递增求和?
![](https://img.aspxhome.com/file/2023/3/a139973_0s.gif)
微商截图王如何生成对话?微商截图王生成对话的方法
![](https://img.aspxhome.com/file/2023/8/a337179_0s.png)
IIS7在Windows Server 2008R2的新改进
Surface怎么重装系统?Surface重装系统教程
![](https://img.aspxhome.com/file/2023/6/a321983_0s.jpg)
Win10怎么技巧性的运行命令提示符?
![](https://img.aspxhome.com/file/2023/28/a246637_0s.png)
笔记本Win10找不到WiFi网络怎么回事?笔记本搜不到WiFi网络解决方法
![](https://img.aspxhome.com/file/2023/26/a219542_0s.jpg)
wps表格怎样设置求和
MAC下通过Time Machine恢复系统技巧
![](https://img.aspxhome.com/file/2023/0/a216010_0s.jpg)
Win7系统提示Windows延缓写入失败怎么办?
![](https://img.aspxhome.com/file/2023/27/a230103_0s.jpg)
WPS演示2013轻松完成字体的替换
![](https://img.aspxhome.com/file/2023/4/a164654_0s.jpg)
iMovie for Mac如何导出视频?iMovie Mac生成视频文件的方法
![](https://img.aspxhome.com/file/2023/6/a213986_0s.png)
刚存的word文档找不到了怎么办?
Word下划线如何输入?Word空白处下划线怎么输入?
![](https://img.aspxhome.com/file/2023/8/31268_0s.png)
微软windows系统一口气推30个补丁更新
![](https://img.aspxhome.com/file/2023/3/a296398_0s.jpg)
Win8.1如何升级邮件/日历/人脉应用以方便生活
![](https://img.aspxhome.com/file/2023/29/a251669_0s.jpg)
电脑字体模糊的解决措施
![](https://img.aspxhome.com/file/2023/2/a286740_0s.png)
Win 2003 加速****
ppt图片怎么快速统一大小并排版?
![](https://img.aspxhome.com/file/2023/10/a348969_0s.jpg )
Win11怎么退回Win10系统?
![](https://img.aspxhome.com/file/2023/1/a283293_0s.jpg)
Win10如何用管理员身份运行Windows终端?
![](https://img.aspxhome.com/file/2023/1/a272792_0s.jpg)