我想创建一个程序:
ChartType = xlColumnClustered
或ChartType(51)
,如下图所示。我已经尝试搜索调试器的Locals窗口中的每个Expression,看看我是否能找到带有数据的图表和没有数据的图表之间的任何差异。我一无所获。我不确定如何区分幻灯片和数据幻灯片。
我也不知道如何访问图表中的数据来应用颜色。
如何处理此问题,我们将不胜感激。
谢谢!
答案 0 :(得分:1)
我在改变条形颜色的过程中录制了一个宏并进行了调整
实际上,powerpoint中有一个电子表格,可以将数据提供给powerpoint中的每个图表
Application.ActivePresentation.Slides(1).Shapes(1).Chart.ChartData.Workbook.activesheet
您必须从工作表中读取数据以确定条形图的颜色,我认为
这里是换色器
Option Explicit
Sub Macro1()
' recorded in excel and modified
Dim chrt As Chart
' Set chrt = ActiveSheet.ChartObjects("Chart 1").Chart ' excel object
Set chrt = Application.ActivePresentation.Slides(1).Shapes(1).Chart
chrt.ClearToMatchStyle
chrt.ChartStyle = 203
chrt.ChartStyle = 340
chrt.ChartStyle = 333
chrt.ChartStyle = 399
chrt.ChartType = xlColumnClustered
Dim fsc As FullSeriesCollection
Set fsc = chrt.FullSeriesCollection
With fsc(1).Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 192, 0)
.Transparency = 0.5
.Solid
End With
With fsc(1).Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
End With
With fsc(2).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
With fsc(3).Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(146, 208, 80)
.Transparency = 0
.Solid
End With
With fsc(3).Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
End With
With fsc(1).Points(1).Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0.6299999952
.Solid
End With
With fsc(1).Points(1).Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0.0500000119
.Weight = 5
.Style = msoLineThickBetweenThin
End With
End Sub
答案 1 :(得分:1)
This post帮助我弄清楚我需要做什么,再加上@jsotola在这里发布的一些逻辑。这是这两个版本的PowerPoint版本,完全符合原始问题的要求。
<div id="right-panel"></div>
<script type="text/javascript">
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer();
var map = new google.maps.Map(document.getElementById('map'), {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('right-panel'));
var request = {
origin: <?php echo $start; ?>,
destination: <?php echo $end; ?> ,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
</script>
</body>
</html>