gpt4 book ai didi

css - 未应用 Flex ColumnSeries CSS 填充

转载 作者:太空宇宙 更新时间:2023-11-03 19:10:03 26 4
gpt4 key购买 nike

我正在尝试使用 CSS 在 Flex (v4.6) ColumnChart 中设置系列的填充颜色。我目前正在使用 setStyle,因为我还设置了 alpha 值,但我知道这是相当耗费资源的,所以我正在考虑不设置 alpha,只使用 CSS 设置颜色。但是,我无法使用类似以下的 CSS 声明让它工作:

mx|ColumnSeries {
fills: #FFCC33, #FF0033, #FF3333, #FF6633, #FF9933;

如果我定义以下样式,它工作正常:

    <fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

.anotherColour { fill: #CCFFB3; }

.andAnotherColour { fill: #BBFF99; }

</fx:Style>

并应用如下:

                <mx:ColumnSeries 
xField="Month"
yField="Profit"
displayName="Profit"
styleName="anotherColour"
/>
<mx:ColumnSeries
xField="Month"
yField="Expenses"
displayName="Expenses"
styleName="andAnotherColour"
/>

有人可以帮忙吗?

谢谢。丹.

不起作用的完整代码示例:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

mx|ColumnSeries {
fills: #CCFFB3, #BBFF99;

}
</fx:Style>


<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:2000, Expenses:1500},
{Month:"Feb", Profit:1000, Expenses:200},
{Month:"Mar", Profit:1500, Expenses:500}
]);]]>
</fx:Script>
<mx:Panel title="Column Chart">
<mx:ColumnChart id="myChart" dataProvider="{expenses}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{expenses}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries
xField="Month"
yField="Profit"
displayName="Profit"
/>
<mx:ColumnSeries
xField="Month"
yField="Expenses"
displayName="Expenses"
/>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</s:Application>

最佳答案

试试这个:

 mx|ColumnSeries {
fills: [0xFFCC33,0xFF0033,0xFF3333,0xFF6633,0xFF9933];
}

关于css - 未应用 Flex ColumnSeries CSS 填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8677686/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com