Setting different Chart DataTip styles in Flex Components

שאלות ודיונים בכל הנוגע לפיתוח פלקס (Flex) ושפת MXML, פלקס מגרסאות 1.5 עד הנוכחית. בנוסף, דיונים בנושא טכנולוגיית AIR לשולחן העבודה (Adobe Integrated Runtime), פיתוח פלאש ל desktop או AIR ל Mobile. עם יציאתה של Slider, פורום זה ידון גם ב Framework הזה.

Setting different Chart DataTip styles in Flex Components

הודעהעל ידי sasmaster ב 01 נובמבר 2011, 08:49

הפורום עדיין חי??? טוב יש לי שאלה למקצוענים:(םרסמתי בSTACKOVERFLOW כך שהכל באנגלית)
I have a following issue:My task is to style a datatip for two charts in Flex 4.5.Both charts reside in two different based components which are added to the So after a thorough research here is what I tried to do.First applying a css descending selectors:
Syntax: [ Download ] [ Hide ]
Using actionscript3 Syntax Highlighting

 #container#chart1 chartClasses|DataTip{

        backgroundColor:white;
        backgroundAlpha:0.01;
        fontSize: 12;
        fontWeight:bold;
        fontStyle:italic;
}
 


 
Parsed in 0.029 seconds, using GeSHi 1.0.8.4

So the component with Id=container and inside it a chart with id="chart1" It doesn't work despite the fact that Adobe docs say it should.
Another approach which I believed was supposed to solve it was to put this CSS style
Syntax: [ Download ] [ Hide ]
Using actionscript3 Syntax Highlighting
 chartClasses|DataTip{

        backgroundColor:white;
        backgroundAlpha:0.01;
        fontSize: 12;
        fontWeight:bold;
        fontStyle:italic;

    }
 
Parsed in 0.027 seconds, using GeSHi 1.0.8.4

inside each of these components but guess what,chart DataTip class selector work only on level(and then it applies the same style to all chart datatips found in the application.So putting it in each of the two components containing the charts has no effect. Next ,I created a class that is fed into dataTipRenderer style of the chart.Then inside the class called MyCustomDataTipRenderer I set the class selector :
Syntax: [ Download ] [ Hide ]
Using actionscript3 Syntax Highlighting
   .dataTip{

        backgroundColor:white;
        backgroundAlpha:0.01;
        fontSize: 12;
        fontWeight:bold;
        fontStyle:italic;

    }
 
Parsed in 0.028 seconds, using GeSHi 1.0.8.4

And yes ,it works.But let's say I want to be able to set different styles for the custom datatip renderer based on the hosting chart.How can I do it ? It seems the Flex SDK has not exposed in any way thr datatipRenderer.So If I effectively set the custom datatip renderer like this: columnchart1.setStyle("dataTipRenderer",CustomDataTip); Then I would like to be able to get access to the instance of the CustomDataTip class.But I can't .So currently the only thing I can do is to create a distinct custom datatip renderer class for each chart.That could be fine if you have only a couple of charts you want to style but what can we do if we have many of them?
"This looks like a job for superman"

סמל אישי של המשתמש
sasmaster
 
הודעות: 436
הצטרף: 14 מרץ 2010, 13:58
מיקום: Rechovot

חזור אל פיתוח Flex ו AIR

 


  • שרשורים בנושאים דומים
    תגובות
    צפיות
    הודעה אחרונה

מי מחובר

משתמשים הגולשים בפורום זה: אין משתמשים רשומים ו 3 אורחים