首页 \ 问答 \ LegendEntries,Range,PieChart,Delete,Condition(LegendEntries, Range, PieChart, Delete, Condition)

LegendEntries,Range,PieChart,Delete,Condition(LegendEntries, Range, PieChart, Delete, Condition)

我一直试图找出错误或者我做错了几天。 我在这里显示当前的输出和它应该是什么。 我想也许我正在用一些错误来定义范围,或者也许是LegendEntries(i) ,不能使用与Points(i)相同的索引。 有什么建议吗? 或者也许我怎么能从另一种方法做到这一点?

这里的事情是获取图表并删除与“0”值相关联的图例和标签。

第一个图形是我当前的输出。 第二个是我的愿望输出,以及我期望用我的代码得到的。

具有0值的传说是“亚洲”和“拉特”,但我当前的输出是抛出“Latam”并且它应该抛出“RoW”,因为“RoW”与0值无关,其值为“5.0%” ”。

Sub CreateChart()
On Error Resume Next
Sheets(1).ChartObjects.Delete

    Dim MyChart As Chart
    Dim rowi As Integer
    Dim MyRange As Range


rowi = Range("I7").Row ' Index to select last row non empty, in this example it's row number 11.
Do While Sheets(1).Cells(rowi, Range("I7").Column).Value = _
IsEmpty(Cells(rowi, Range("I7").Column))
rowi = rowi + 1
Loop

'----------------------------------------------------CHART---------------------------------------------------------------

Set MyRange = Range("I6:M6" & ",I" & rowi & ":M" & rowi)

Set MyChart = Sheets(1).Shapes.AddChart(xlPie).Chart

     MyChart.SetSourceData Source:=MyRange

With MyChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.NumberFormat = "0.0%"
End With

With MyChart
 .HasLegend = True
End With

For i = 1 To (Range("M6").Column - Range("I6").Column + 1)

If  Cells(rowi, Range("I6").Column + i - 1).Value = 0 Then
MyChart.SeriesCollection(1).Points(i).DataLabel.Delete
MyChart.Legend.LegendEntries(i).Delete
End If

Next i
End Sub

电流输出

欲望输出


I've been trying to find the mistake or what I'm doing wrong for a few days. I show here the current output and what it should be. I think maybe I'm defining the range with some mistake, or maybe LegendEntries(i), doesn't work with the same index as Points(i). Any suggestion ? Or maybe how could I do this from another approach ?

The thing here is to get a chart and delete the legend and labels associated with "0" values.

The First graphic is my current output. The second one is my desire output, and what I expected to get with my code.

The Legends that have 0 values are "Asia" and "Latam", but my current output is throwing "Latam" and it should throw "RoW", because "RoW" insn't associated with 0 values, its value is "5.0%".

Sub CreateChart()
On Error Resume Next
Sheets(1).ChartObjects.Delete

    Dim MyChart As Chart
    Dim rowi As Integer
    Dim MyRange As Range


rowi = Range("I7").Row ' Index to select last row non empty, in this example it's row number 11.
Do While Sheets(1).Cells(rowi, Range("I7").Column).Value = _
IsEmpty(Cells(rowi, Range("I7").Column))
rowi = rowi + 1
Loop

'----------------------------------------------------CHART---------------------------------------------------------------

Set MyRange = Range("I6:M6" & ",I" & rowi & ":M" & rowi)

Set MyChart = Sheets(1).Shapes.AddChart(xlPie).Chart

     MyChart.SetSourceData Source:=MyRange

With MyChart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.NumberFormat = "0.0%"
End With

With MyChart
 .HasLegend = True
End With

For i = 1 To (Range("M6").Column - Range("I6").Column + 1)

If  Cells(rowi, Range("I6").Column + i - 1).Value = 0 Then
MyChart.SeriesCollection(1).Points(i).DataLabel.Delete
MyChart.Legend.LegendEntries(i).Delete
End If

Next i
End Sub

Current Output

Desire Output


原文:https://stackoverflow.com/questions/37847475
更新时间:2020-11-27 15:11

最满意答案

充分披露,我是Telo的首席运营官, OpenCNAMEveryoneAPI的制作

我想澄清这个问题的初始答案中包含的一些事情。 我不得不回答这些问题,因为我在Stack Overflow上的代表权限限制了我发布这个问题的能力。 :/

首先是网络CNAM的快速概述。 接下来,简要说明它的工作原理和注意事项。 在那之后,Telo产品有一些具体细节,有些人可能会发现其价值。

网络CNAM概述

在+1拨号方案( NANP )中,有超过20个数据库代表电话公司存储CNAM值或呼叫者姓名。 实际上,其中约有12个实际上是由CNAM提供商查询的。 终端运营商(接收呼叫的运营商)在收到带有CID(电话号码)的呼叫后查询其CNAM提供商毫秒。 当呼叫被设置为振铃时,CNAM提供商将返回与该电话号码关联的姓名值,以便可以通过电话呼叫。

这是如何工作的

如果网络CNAM正在交付 - 也就是说,由运营商的存储提供商存储的运营商提供的值 - 则CNAM提供商将根据电话号码将查询路由到相应的存储提供商。 如果一个号码已被移植,那么NPAC将包含将该号码解析到要查询的适当存储源所需的信息。 如果NPAC中没有记录,那么CNARG将包含将电话号码与运营商相匹配所需的信息,从而提供正确的存储提供商。

注意事项

传统CNAM网络中有用名称值的匹配率大约为50%。 这是由于并非所有运营商都参与这一事实。 例如,虽然很容易为AT&T无线,T-Mobile和Sprint设置CNAM值,但Verizon Wireless是'选择加入',并不会自动支持。 还有其他运营商不参与CNAM网络,而且其他VoIP提供商不更新CNAM值。 传统的CNAM网络也不提供免费电话号码的价值,只覆盖+1拨号计划。

关于OpenCNAM

尽管OpenCNAM通过其标准服务级别提供网络CNAM,但它还提供了两个服务级别来解决上述网络CNAM的局限性。 Plus服务级别针对覆盖范围,匹配率和准确性进行了优化,而价值服务级别提供了出色的覆盖率和匹配率,但针对成本进行了优化。 你可以在这里找到更多关于服务水平的信息

EveryoneAPI适用于当前运营商和线路类型

我们的其他产品EveryoneAPI提供围绕线型(固定电话或移动电话)和当前运营商的最准确数据,其中包括移植号码。 这些数据点的覆盖范围是全球性的,匹配率接近100%。 虽然numverify看起来非常有用,但它提供了我所知道的+1拨号计划的LERG数据。 这不能准确反映携带电话号码的运营商信息。


CNAM Overview and Limitations

CNAM / Caller ID Name support is dependent on the the type of numbers used by the calling and receiving (callee) parties.

  • Caller must be using a local landline number, otherwise the phone number will be displayed.
  • Receiver must be using a non-mobile number, otherwise the phone number will be displayed.

I validated this by calling two numbers, a mobile number that showed only the phone number and a landline number that showed the CNAM.

You can read more on CNAM in this Knowlegebase Article:

This mentions the following excerpts:

  • The Outbound Caller ID Number must be a local landline number.
  • Toll free numbers are not supported. When the Outbound Caller ID is set to a Toll Free number, only the number will display.
  • Mobile numbers do not support CNAM. If the receiving party is a Mobile number, only the number will display.
  • When the Outbound Caller ID is set to Blocked, the call recipient will see UNKNOWN or ANONYMOUS as the Caller ID/Caller Name.

Checking Receiving Line Type

Given that mobile numbers don't support CNAM, it's useful to see if the number you are calling is a mobile number of not. You can verify the type of number you are calling by using the numverify API (https://numverify.com/). You can also use this CLI app and Go SDK grokify/numverify. Look for the line_type property in the validate API response which can be mobile or landline.

For example (phone number changed):

{
    "valid": true,
    "number": "16505550100",
    "local_format": "6505550100",
    "international_format": "+16505550100",
    "country_prefix": "+1",
    "country_code": "US",
    "country_name": "United States of America",
    "location": "Redwood Cy",
    "carrier": "AT\u0026T Mobility LLC",
    "line_type": "mobile"
}

Checking the CNAM Database

Receiving systems have their own CNAM databases, but you can check to see if your name has propagated by calling a CNAM database API, such as the one provided by OpenCNAM (https://www.opencnam.com/). Here is an example call for OpenCNAM. Adding the format query parameter is very important as the API will retry an empty body without it.

curl -XGET 'https://api.opencnam.com/v3/phone/+16505550100?format=json&account_sid=<myAccountSID>&auth_token=<myAuthToken>

You will receive a response like:

{
    "name": "My Caller ID Name",
    "number": "+16505550100",
    "price": 0.0039,
    "uri": "/v3/phone/+16505550100"
}

相关问答

更多
  • Twilio Evangelist在这里。 我认为最好的方法是使用使用'Whisper'。 我们的想法是,当您使用您可以将号码指定为仅测试: +447123456789 但您也可以使用标记: +447123456789 这允许您使用 ...
  • Twilio福音传教士在这里。 当Twilio向您的应用程序发出HTTP请求,让您知道有人调用了您的Twilio号码时,我们会传递一堆表格编码参数 ,包括该人称之为Twilio的电话号码。 您的网络平台应该有一种方法可以从传入的请求中获取这些参数。 例如在PHP中它看起来像这样: $from = $_REQUEST['To']; 在.NET中,有很多方法可以做到,但这里有一个: Request.Form["To"] 希望有所帮助。 Twilio evangelist here. When Twilio ...
  • 经过长时间的搜索,我找到了答案。 您可以使用变量继承。 https://wiki.asterisk.org/wiki/display/AST/Variable+Inheritance 这允许我将传入的CID存储到一个名为EXTERNAL_NUM的变量中,如下所示: exten => _1499,n,Set(__EXTERNAL_NUM= ${CALLERID(num)}) exten => _1499,n,Queue(swb_q,tTkK) 请注意变量名称的2x _ in。 2x _用于多重继承。 1x ...
  • 充分披露,我是Telo的首席运营官, OpenCNAM和EveryoneAPI的制作人 。 我想澄清这个问题的初始答案中包含的一些事情。 我不得不回答这些问题,因为我在Stack Overflow上的代表权限限制了我发布这个问题的能力。 :/ 首先是网络CNAM的快速概述。 接下来,简要说明它的工作原理和注意事项。 在那之后,Telo产品有一些具体细节,有些人可能会发现其价值。 网络CNAM概述 在+1拨号方案( NANP )中,有超过20个数据库代表电话公司存储CNAM值或呼叫者姓名。 实际上,其中约有1 ...
  • 您可以在Diversion标题中看到“原始”电话号码 我不确定星号处理这个标题,但你仍然可以通过函数SIP_HEADER获得它 Set(DEVERSION=$SIP_HEADER(Diversion)) 问题是此标头不是强制性的,并且大多数SIP(DID)提供程序根本不进行重定向。 You can see 'original' phone number in Diversion header I don't sure asterisk processes this header but you can s ...
  • 因此,如果你想做任何涉及电话和电话系统等的事情......你的起点是使用TAPI API。 这是链接http://msdn.microsoft.com/en-us/library/windows/desktop/ms734257(v=vs.85).aspx 这实际上是一个非常强大的api,可以用于更多的东西,而不仅仅是获得一个来电显示。 So if you want to do anything that deals with telephony and phone systems, etc... Your ...
  • 最近推出了一些服务,允许您使用API接听电话: http://cloudvox.com/ http://www.twilio.com/ 这些可能比尝试亲自接听电话更容易。 如果您使用调制解调器,那么您显然需要驱动程序,并针对这些驱动程序暴露的任何API进行编程。 无论哪种方式,您都需要一种方法将电话呼叫链接到网站上的会话 - 可能为每个访问者生成一个唯一的号码,或者让他们在呼叫时输入一系列数字。 然后工作流程看起来像 用户访问网站 网站生成会话ID,提供用户电话号码 用户响铃号码 由cloudvox / t ...
  • 这在非越狱的iOS设备上是不可能的。 你需要查看越狱iPhone上的plist文件。 您可以签入/ System / Library / CoreServices / ,或者与Preferences或CoreTelephopny.任何内容CoreTelephopny. 此外,它应该不言而喻,但您将无法在App Store版本中使用此类功能,因为这是严格的私有API 。 This is not possible on non-jailbroken iOS devices. You will need to l ...
  • 答案很简单。 AddIdentificationEntry()需要国家代码,AddBlockingEntry()不需要。 当我在电话号码的开头添加47(挪威的国家代码)时,它有效。 以下是显示挪威电话号码22334455的来电显示的工作代码: public override void BeginRequestWithExtensionContext(NSExtensionContext context) { var cxContext = (CXCallDirectoryExtensionContext ...
  • Twilio开发者传道者在这里。 您可以使用传出呼叫者ID资源通过REST API验证呼叫者ID。 基本上,您使用要验证的号码向该端点发出POST请求。 Twilio将使用您需要向用户显示的代码进行响应。 Twilio还会发起对该电话号码的呼叫,要求用户输入密码。 一旦他们正确完成,将验证该号码。 Twilio developer evangelist here. You can verify caller ids via the REST API using the Outgoing Caller IDs ...

相关文章

更多

最新问答

更多
  • 使用通配符获取更多servlet请求变量[重复](Get more servlet request variables using wildcards [duplicate])
  • 返回相同的集合类型,参数化不同(Returning same collection type, differently parameterised)
  • C ++朋友函数模板重载和SFINAE在clang ++,g ++,vc ++中的不同行为(C ++ 14模式)(C++ friend function template overloading and SFINAE different behaviors in clang++, g++, vc++ (C++14 mode))
  • 与paure IoT-Hub的Python paho-MQTT连接(Python paho-MQTT connection with azure IoT-Hub)
  • 编译器警告“来自不同的Objective-C类型的赋值”(Compiler warning “assignment from distinct objective-c type”)
  • C ++编译错误(在此函数中未初始化)[重复](C++ Compile Error (uninitialized in this function) [duplicate])
  • unsigned-signed下溢机制(unsigned-signed underflow mechanism)
  • 快速行查询的数据结构?(Data structure for fast line queries?)
  • 饥荒有手机安卓版的吗
  • Jquery可拖动碰撞检测错误(Jquery draggable collision detection bug)
  • sql调优是怎样来实现的?
  • 无法使占位符输入文本消失(Unable to make the placeholder input text disappear)
  • jQuery改变了两个div的CSS属性(JQuery change CSS property of two div's)
  • JDK中包含的库版本(Versions of libraries included in the JDK)
  • 请问下载的是出现ASP是什么意思
  • Firebase MLkit用于数字液晶显示器的文本识别(Firebase MLkit Text recognition for digital lcd displays)
  • 我可以在任何平台上运行C和C ++吗?(Can I run C and C++ on any platform?)
  • 让小组在C#的特定位置(get panel at specific positions in C#)
  • Nagios为通知设置了更高的间隔(Nagios set higher interval for notifications)
  • 无法向SMTP主机发送电子邮件(unable to send an email to SMTP host)
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何在.NET代码中验证全球邮政编码(How can I validate worldwide postal codes in my .NET code)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • Clojure:减少大型懒惰收集会占用内存(Clojure: Reducing large lazy collection eats up memory)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • 显示作为字符串的SVG(Showing an SVG that I have as a string)
  • 从jansson库里创建json请求的自由内存的正确方式是什么?(what is the proper way of free memory in creating json request from jansson libary?)
  • jQuery插件无法正常工作 - 它是附加的(jQuery plugin not working - it's appended)
  • 使用stat_summary自动调整ylim(Automatically adjusting ylim with stat_summary)