Charting pie chart by setting the fontWeight style on t

Charting pie chart by setting the fontWeight style on t

Postby haretu » Thu Feb 17, 2011 8:17 pm

Charting Legend control by setting the fontWeight style on the LegendItem CSS selector

pie chart

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/23/setting-the-font-weight-on-the-mx-legend-control-in-flex-4/ -->
<s:Application name="MX_LegendItem_fontWeight_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">

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

        @font-face {
            src: url("C:/Windows/Fonts/comic.ttf");
            fontFamily: myEmbeddedFont;
            fontWeight: normal;
            embedAsCFF: false;
        }

        mx|LegendItem {
            color: white;
            fontFamily: myEmbeddedFont;
            fontSize: 16;
            fontWeight: normal;
        }
    </fx:Style>

    <fx:Declarations>
        <s:XMLListCollection id="dp">
            <s:source>
                <fx:XMLList>
                    <product label="Product 1" data="3" />
                    <product label="Product 2" data="1" />
                    <product label="Product 3" data="4" />
                    <product label="Product 4" data="1" />
                    <product label="Product 5" data="5" />
                    <product label="Product 6" data="9" />
                </fx:XMLList>
            </s:source>
        </s:XMLListCollection>
    </fx:Declarations>

    <s:Panel left="20" right="20" top="20" bottom="20">
        <s:controlBarContent>
            <mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" />
        </s:controlBarContent>
        <mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%">
            <mx:series>
                <mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" />
            </mx:series>
        </mx:PieChart>
    </s:Panel>

</s:Application>
Attachments
pie.jpg
pie.jpg (30.24 KiB) Viewed 839 times
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Adobe FLEX Flash

Who is online

Users browsing this forum: No registered users and 1 guest

cron