0

我必须在 Highchart 图例值中去除这些标签。请查看图例值:

data: [
{/literal}
{foreach from=$value[2] item=an key=a}
{literal}
{name: '{/literal}{$a}:{$an}{literal}',y: {/literal}{$an}{literal}, color: '#6B8E23'},
{/literal}
{/foreach}
{foreach from=$value[1] item=foo key=k name=myloop}
{assign var=op value=$smarty.foreach.myloop.index}
{assign var=cor value=$colors.$op}
{literal}
{name: '{/literal}{$k}:{$foo}{literal}',y: {/literal}{$foo}{literal}, color: '{/literal}{$cor}{literal}'}
{/literal}
{if $op le $count},{/if}
{/foreach} 
{literal}
]

请找到附件图片供您参考在此处输入图像描述

4

1 回答 1

0

那是 html 实体,请参阅http://www.w3schools.com/tags/ref_entities.asp

您可以用它们的真实符号替换它们,而不是删除它们。

var Str = "Slogans such as McDonalds's";
Str = String(Str).replace(/'/g, "'").replace(/"/g, '"');

如果您想剥离它们,只需将代码更改为

var Str = "Slogans such as McDonalds's";
Str = String(Str).replace(/'/g, '').replace(/"/g, '');

这是一个小提琴作为演示,http://jsfiddle.net/Zx9cn/

于 2012-12-11T17:16:44.320 回答