简体   繁体   English

Excel中的自定义图形,x值始终为100%,y小于或大于,显示该百分比

[英]Custom graph in excel, x value is always 100% and y is a less than or greater than, showing that percent

I have made a big macro generateing a graph to dynamic data. 我做了一个大宏,可以生成动态数据图。 However, one of my graphs will show actual hours vs estimated. 但是,我的一张图表将显示实际小时数与估算时间。 I am using a stacked 100% but the porblem is est vs act can only be possible if est is < actual. 我使用的是堆叠的100%,但问题只有在est <实际时才能实现。 I would like to set actual at 100% then have the second data series, estimated, to be either below or aboe that 100% to show 80% or 120% etc. 我想将实际值设置为100%,然后将第二个数据系列估计为小于或等于100%表示80%或120%等。

Thanks so much :)! 非常感谢 :)!

ActiveSheet.ChartObjects("Monthly").Delete ActiveSheet.ChartObjects(“ Monthly”)。Delete

For Each ws In Worksheets
 If ws.Name <> "Summary" And ws.Name <> "Calenders" And ws.Name <> "Front Page" And ws.Name <> "Arc" Then
        ws.Range("F129").Copy
        ActiveSheet.Range("BH65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    End If
Next ws


 For Each ws In Worksheets
 If ws.Name <> "Summary" And ws.Name <> "Calenders" And ws.Name <> "Front Page" And ws.Name <> "Arc" Then
        ws.Range("G128").Copy
        ActiveSheet.Range("BI65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    End If
Next ws


  Range("BJ2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("BJ2").Select
Selection.AutoFill Destination:=Range("BJ2:BJ75"), Type:=xlFillDefault
Range("BJ2:BJ75").Select

ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnStacked100




ActiveChart.Parent.Name = "Monthly"



ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = "=Summary!$BH$2:$BH$53"
ActiveChart.SeriesCollection(1).Name = "=""Estimated"""

Perhaps a stacked bar is not the best type of chart for this problem. 也许堆积条形图不是解决此问题的最佳图表类型。

Why not just use a simple column chart plotting the deviation (+/-), like this: 为什么不使用简单的柱形图绘制偏差(+/-),如下所示:

柱状图显示预算偏差

The research nerd in me suggests using stacked bar/column only for ordinal data type :) eg, categories like "< 1 week", "1-2 weeks", "3+ weeks", etc. 我的研究书呆子建议仅对有序数据类型使用堆叠的条形/列:),例如“ <1周”,“ 1-2周”,“ 3+周”等类别。

Alternatively used a simple stacked bar/column (ie, NOT the stacked 100%), which should allow you to display values like 120%. 或者使用简单的堆叠条形图/列(即,不是堆叠的100%),它应该允许您显示120%之类的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM