Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更改drillUpButton文本的字体颜色_Javascript_Css_Highcharts - Fatal编程技术网

Javascript 更改drillUpButton文本的字体颜色

Javascript 更改drillUpButton文本的字体颜色,javascript,css,highcharts,Javascript,Css,Highcharts,我想知道如何更改钻孔按钮文本的字体颜色。我尝试了css来提取元素,比如:g.highcharts-button highcharts drillup button highcharts button normal text{color:blue;},但是它不起作用。 drillUpButton API仅提供如何更改按钮本身的主题,而与文本无关 drillUpButton: { relativeTo: 'spacingBox', position: {

我想知道如何更改钻孔按钮文本的字体颜色。我尝试了css来提取元素,比如:g.highcharts-button highcharts drillup button highcharts button normal text{color:blue;},但是它不起作用。

drillUpButton API仅提供如何更改按钮本身的主题,而与文本无关

drillUpButton: {
        relativeTo: 'spacingBox',
        position: {
            y: 10,
            x: 0
        },
        theme: {
           color: "#5ab7f5",
            fill: 'white',
            'stroke-width': 2,
            stroke: '#5ab7f5',
            r: 5,
            states: {
                hover: {
                    color: 'white',
                    fill: '#5ab7f5'
                },
                select: {
                    fill: '#5ab7f5'
                }
            }
        }
    },

您在
tspan
方面做得不够,您使用的是颜色而不是填充。在选择课程时,您还缺少几个“.”

创建这个规则似乎是可行的

g.highcharts-button.highcharts-drillup-button text tspan{
  fill: blue;
}
如果您不想键入所有这些
。highcharts drillup按钮文本tspan
也可以


您可以通过使用highchart drillup button css Styleing类将颜色应用于文本来更改文本的颜色。它的simple
color:red
属性不起作用的原因是,它是在运行时创建的svg,svg还为文本设置了填充属性,该属性会覆盖颜色。除此之外,您还需要使用
强制自定义类颜色!每个属性集的重要关键字。因此,只需在自定义css中添加以下类,向上钻取按钮文本就会更改

.highcharts-drillup-button text{
   color: red !important;
   fill: red !important;
}
希望这有帮助。

使用此选择器:

.highcharts-button-box+text {
  fill: red !important;
}
示例:

如果有人想避免使用CSS选择器,您可以使用
style
属性将CSS样式添加到文本按钮

主题:{
样式:{color:“red”},
...
}

酷!非常感谢。highcharts drillup按钮文本tspan运行良好。虽然我不怀疑这一点,但我警告使用
!重要信息
,尽可能避免。