English 中文(简体)
如何用像样的电网方式对多个部分(如第1页,第2页,第3页)贴上你的格式(斜体)标签?
原标题:How do you format (align) labels made of multiple parts (e.g., p1, p2, p3) in a grid like fashion?

该图的数据提供者包含一系列设施目标。 设施标有几部分,显示安装识别器、设施号码和设施名称如下:

{
   installationID:1000,
   facilityNum:529,
   facilityName:"Building1"
}

我有一张显示每栋楼能源消耗情况的图表。 从几个不同区域绘制的图表中可以显示一些建筑物。 我想:

  1. Group all the buildings in the same region together.
  2. Include a region label only when it starts a new group.
  3. Align the label parts in a grid such that:
    • All region labels are left aligned with each other.
    • All Building IDs are right aligned with each other.
    • Building names are left aligned with each other.

下表显示了所期望的产出。

“Desired

采用适用于第一类轴心的习惯标签功能,就可以将数值推到一处。 如果一个新集团正在启动,则通过划分阵列区域身份证,我甚至可以删除(不增加)。 此处显示的是习俗标签功能。

private var nextCategoryIndex:int = 1;

public function facilitiesLabelFunction(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String
{
   var nextInstallationID:String = "";
   var facilitiesColl:ArrayCollection = ArrayCollection(axis.dataProvider);

   // if this is not the last facility to be processed get the next installation ID
   if (nextCategoryIndex <= facilitiesColl.length - 1) {
      nextInstallationID = facilitiesColl[nextCategoryIndex].installationID;
   }

   var label:String = categoryItem.facilityNum + " - " + categoryItem.facilityName;

   // preppend the installation id when we start listing facilities from a different installation
   if (nextInstallationID != categoryItem.installationID) {
      label = categoryItem.installationID + " " + label;
   }

   nextCategoryIndex++;
   return label;
}

然而,这产生了一种适当的组合体(如预期)。 我想要实现的是上述三种特性的左边、右边和左侧。

我试图将标签功能中的财产价值与“限定者”混为一谈。 想法是,我可以创建习惯标签使者分裂这一限定者,并根据需要进行调和。 然而,我似乎无法改变在习惯标签使者内贴上标签的做法。

我怎么能够把多部分标签与灵活图表中的类似格格格格格格结合起来?

最佳回答

我不知道弹性体内任何多部分标签能力,但你可以创造能够以你所希望的方式包含和调整任何种类的标签(或其他部件)。 这样做应该奏效(不是完整或测试的,而是应该把你引向正确的方向):

<mx:BarChart>
    <mx:AxisRenderer>
        <mx:labelRenderer>
            <fx:Component>
                <s:Group width="300">
                    <s:Label left="0" text="{data.leftvalue}" />
                    <s:Label horizontalCenter="0" text="{data.centervalue}" />
                    <s:Label left="right" text="{data.rightvalue}" />
                </s:Group>
            </fx:Component>
        </mx:labelRenderer>
    </mx:AxisRenderer>
</mx:BarChart>
问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签