Changing chart series colors with colorpicker

I am trying to implement functionality to allow the user to
select what color he wants a particular series item in a chart to
be. Here's what I'm doing, but it doesn't work. I get the series
object returned correctly, but "setStyle" doesn't do anything.

Alright, I think I have something you're looking for. This
updates the series' color in the legend, too.
<?xml version="1.0"?>
<!-- charts/BasicLine.mxml -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
import mx.collections.ArrayCollection;
import mx.charts.events.ChartItemEvent;
import mx.controls.ColorPicker;
import mx.events.ColorPickerEvent;
import mx.charts.HitData;
import mx.charts.chartClasses.ChartElement;
import mx.graphics.Stroke;
import mx.charts.series.items.LineSeriesItem;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:2000, Expenses:1500, Amount:450},
{Month:"Feb", Profit:1000, Expenses:200, Amount:600},
{Month:"Mar", Profit:1500, Expenses:500, Amount:300}
private var cp:ColorPicker;
private var csi:LineSeriesItem;
private var el:ChartElement;
private function doSomething(e:ChartItemEvent):void {
var hitData:HitData = e.hitData;
csi = LineSeriesItem(hitData.chartItem);
el = ChartElement(csi.element);
cp = new ColorPicker();
myChart.addChild(cp);
cp.addEventListener(ColorPickerEvent.CHANGE,
changeItemColor);
cp.x = e.localX;
cp.y = e.localY;
cp.open();
private function changeItemColor(e:ColorPickerEvent):void {
var s1:Stroke = new Stroke(cp.selectedColor, 4, 1); //First
3 arguments are color, weight, and alpha.
el.setStyle("lineStroke", s1);
// Use this if it's a column or bar series:
// var c:SolidColor = new SolidColor(cp.selectedColor);
//el.setStyle("fill", c);
//csi.itemRenderer.height = csi.itemRenderer.height;
myChart.removeChild(cp);
]]></mx:Script>
<mx:Panel title="Line Chart">
<mx:LineChart id="myChart"
dataProvider="{expenses}"
showDataTips="true"
itemClick="doSomething(event)"
>
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{expenses}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries
yField="Profit"
displayName="Profit"
selectable="true"
/>
<mx:LineSeries
yField="Expenses"
displayName="Expenses"
selectable="true"
/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</mx:Application>
matt horn
flex docs

Similar Messages

  • Change Chart background color during runtime

    I want to change the background color of my chart during runtime.
    I can set and read-out the color with a property node but the apperance on the frontpanel is not changing.
    After stopping the VI the chart suddenly gets updated.
    Please check my VI attached.
    Do someone knows a workaround?
    Attachments:
    chart.vi ‏9 KB

    Hello Robert,
    another option would be to place (for example) a vertical smooth box behind the chart and change the color of it.
    See my attachment.
    Best regards
    Attachments:
    Change chart background color.vi ‏12 KB

  • Change Browser Background Color with Image Fill

    I inserted a picture using 'Image Fill' and 'Original Size' under Browser Background in the Page Layout tab and the browser background, I assume, defaults to white.
    I need the browser background to be a standard black color with an Image Fill. I searched around the iWeb preferences and tabs but found no option...
    Many thanks in advance!
    Alex

    The only way to get a black browser background is to set it to black. If you tile the photo there will be not browser background or make the image large enough so that it would take a very large browser window to exceed the photo's size. Or create a very large canvas with the photo in it at its original size and the rest of the area black.
    OT

  • Change footer font color with embedded form?

    How do I change the font color on the footer of a form in FormsCentral?
    When I developed the form I was using a design that looked great in a standalone format, but we're considering embedding the form. When I went to embed the form, the links at the bottom became useless because the font in the footer is white (see attached screen shots).

    Hi,
      In order to see the background color of the form, you will have to enable it.
    Open the form in FormsCentral, go to Distribute tab / Embed sub tab and check : "Include page background color" check box.
    >>How do I change the font color on the footer of a form in FormsCentral?
    You will need to change the text color of your form header.  Open the form in FormsCentral, select Design Tab, select the form header, select the text and change the text color to other-than-white via the Toolbar.
    Hope this works for you,
    Thanks,
    Lucia

  • Chart series color

    Hi
    I have a simple bar chart and I want all of it's bars to have the same color.
    Is that possible?
    Any ideas on how to achieve that?
    Regards
    Shlomi

    Hi Shlomi,
    Yes, it is possible.
    Design Studio 1.3:
    Option 1 (typical use case: if your dimension doesn't have too much different values and it has the same values - no new values are added dynamically, for example you have applied a background filter to max. 20 fixed dimension values): Chart > Additional Properties > Data Series: here you can define a different color for each dimension value; you would define the same color for each dimension value
    Option 2 (typical use case: if your dimension has a lot of values which are not fixed in your chart - they change if new data gets loaded or different filters are applied to the data source): Chart > Properties > Display > Conditional Formatting > New Rule...: create a rule where either your measure or dimension meets a condition and choose the color that should be used if the condition is true
    Or use CSS in your custom CSS file (should also work in DS 1.2, but I tested it only in DS 1.3):
    for example:
    /* Chart Type: Bar ; change color for bars */
    .v-m-plot .v-bar rect {fill: orange; stroke: white/*brown*/;}
    /* Chart Type: Bar ; change color for dimension values in legend */
    .v-legend-content path {fill: orange;}
    ...you can further customize the css with other styling too.
    Best Regards,
    David

  • Easiest way to change font size/color with CSS?

    I've never used CSS before; I need to know how to change the font size and color using CSS, since it seems to be the only way to do it now. Sometimes I just need to change the font just for a few words, or a line here and there. Not necessarily page-wide, you understand. Is there a step-by-step process showing the simplest way to accomplish this? I'm not a web developer or professional designer, nor do I want to be. I just use DW to build simple web sites for personal use. I don't build using HTML - I solely use DM's GUI functions. And I'm also trying to teach my nine year-old how to start out page-building. I certainly hope that something as simple as changing font size doesn't require one to buy a book to learn HTML, which seems to be what a lot of people are telling me. Thanks for any assistance.

    Easiest is not always the best way.  You must learn the fundamentals. 
    CSS
    /**this styles all paragraphs in your site**/
    p {
    font-size: 18px;
    color: #000;
    /**This is a class.  Classes are re-usable**/
    .red {
    color:red;
    font-weight:bold;
    HTML:
    <p>This is a normal paragraph</p>
    <p class="red">This is a red paragraph</p>
    <p>This is a normal paragraph with <span class="red">some red text here</span> but not here.</p>
    If you're going to teach your 9yr old how to build web pages, start with the links below.
    There's no point in teaching your child bad habits that will have to be unlearned later.
    http://www.html.net/
    http://w3schools.com/
    http://www.csstutorial.net/
    http://phrogz.net/css/HowToDevelopWithCSS.html
    Nancy O.

  • Can I Change My Eye Color with iPhoto?

    Suppose I have a close up picture of someones face. Lets say their eye color ir brown.
    can iphoto editing change the color of their eye? Like how photoshop can?
    or can it even lighten the color of the eyes

    You might be able to do a little of that with the free image editor Seashore. I did a quick test and could re-color small areas but it will take a lot of tweaking and trial and error to get it right. Worth a try maybe.
    Do you Twango?

  • How to change blog title color with modern template?

    hello everyone,
    I want to change the blog title color from the default red to another color but can't find a setting to let me do so. Can anyone help me out and let me know how I can change this? Here is a link to my site to show you what I'm talking about...
    http://web.mac.com/stephenjames716/iWeb/home/blog/blog.html
    thanks,
    Steve

    Hey Stephen...
    For the main blog index page, you can edit the CSS the same way you have done in the past...
    http://discussions.apple.com/message.jspa?messageID=1596652#1596652
    You can also edit the template XML directly, but I'll leave that to Suzanne or someone more experienced to explain.
    http://discussions.apple.com/thread.jspa?messageID=3139039&#3139039
    If you are referring to the blog entry titles and don't care that the main blog index titles will remain red, you can always change the color of the title text in your blog entry. Then when you want to start a new entry, just duplicate the last entry and all the settings will remain the same.

  • Change HTML background color with AS3

    Hi all,
    I'm looking or a way to change my HTML background color trough Flash.
    The problem is it's not working any ideas? here is the code i'm using
    HTML HEAD
    <script language="JavaScript">
    function changeBgColor(newBgColor)
    if (window.document && window.document.bgColor)
            document.bgColor = newBgColor;
    </script>
    Flash document
    import flash.external.*;
    var jsCall:String;
    this.addEventListener(Event.ENTER_FRAME, bgChange)
    function bgChange(e:Event):void{
        jsCall = String(ExternalInterface.call("changeBgColor", "#FF0000"));
    best regards!!!

    Change your AS3 function code to be more like...
    function bgChange(e:Event):void{
        var result:Object = ExternalInterface.call("changeBgColor", "#FF0000");
    and I suggest you do not use...
    this.addEventListener(Event.ENTER_FRAME, bgChange)
    as that will continuously trigger the function call at the frame rate of the Flash file.  If the intention is to only trigger it once, then just use...
    bgChange();

  • Change applet background color with a button

    Does anyone know how to change the background of an applet by clicking a button within the applet? Thanks.

    Add an ActionListener to the button which calls the setBackground method.

  • Unable to change/reset colors with open document in Photoshop CC 2014

    I have the 2014.2.2 release of Photoshop CC 2014 and am suddenly unable to change or reset colors with an open document. I get a "Could not complete your request because of a program error" message. After closing the document (or before opening one) I can change colors okay. But not with a document open.

    OK, then resetting Photoshop's preferences is the next thing to try. But first, save a copy of the existing preferences - we may need them to figure out what is going wrong.
    See this page for ways to reset your prefs: Photoshop Help | Preferences

  • Setting series color in the Business Graphics UI element

    Hi all,
    I'm using the Business Graphics UI element in my Web Dynpro application.
    I set the color for various properties using chart designer, then I add the generated XML in the doModifyView method: bg.setDirectCustomizing(xml file) and most of it works.
    However, when I change the series' color, I don't see any change in the xml file (see snapshot).
    http://img90.imageshack.us/my.php?image=graphjy1.jpg
    My xml starts with <SAPChartCustomizing> and ends with </SAPChartCustomizing>.
    How can I set the series' color using the custom xml file?
    Thanks,
    Omri

    Hi,
    as the connection between your data and the customizing settings works via IDs you have to make sure that you set exactly the same ID for a data series as defined in the chart designer.
    In case that you use point customizing make sure that you do not set an ID for the points of your series. Instead set the series customizing ID for the series only! Keep in mind that point customizing always overwrites series customizing if both are defined.
    Regards, Kai

  • How to customize line chart series and symbols?

    Hello Forum,
    who can help me to customize line chart series and symbols color?
    I need to customize this in dynamic way.
    Thanks in advanced.

    See example 8-10 (Example 8-10 Changing Chart Symbol Color) from http://docs.oracle.com/javafx/2.0/charts/css-styles.htm#CIHGIAGE (reproduced here).
    The linked tutorial document contains a picture of how this example renders.
    .chart-series-line {   
        -fx-stroke-width: 2px;
        -fx-effect: null;
    .default-color0.chart-series-line { -fx-stroke: #e9967a; }
    .default-color1.chart-series-line { -fx-stroke: #f0e68c; }
    .default-color2.chart-series-line { -fx-stroke: #dda0dd; }
    .default-color0.chart-line-symbol { -fx-background-color: #e9967a, white; }
    .default-color1.chart-line-symbol { -fx-background-color: #f0e68c, white; }
    .default-color2.chart-line-symbol { -fx-background-color: #dda0dd, white; }Note the two comma separated colors listed for each -fx-background-color for the chart-line-symbol.
    The first color is the color or the outside of the symbol, the second is the inside of the symbol.
    In the sample css you provided you only supply a single background color for the chart-line-symbol, when two colors are required.

  • Is there a way to change the font color for emailing and the signature?

    Is there a way to change the font color with email signature on the iPhone and iPad?
    I changed the color in Word on my laptop, emailed and copied to my signature, but it converts it back to black........

    Looks like you didn't get a reply on your post, but it is still a problem.  Font size is supposedly changeable via "Accessibility" in Settings, but it doesn't work.  You can turn on "Zoom".

  • How to programmatically change the cell color of an ADF table ?

    Hi all,
    I have an ADF table with some fields on it. Depending on the value of a field named, say, "F1", I would like to change its background color.
    So far I can change the field color with this EL expression inside the InlineStyle table column property:
    font-size:medium; background-color:#{viewScope.myBean.setColor};
    where setColor is a bean function, in where I access the field "F1" via binding, parse its value, and return the right value - so far, so good.
    The bad thing is, the InlineStyle affects that field in all the rows of the table, while I would like to change only the field in the rows, which have that specific value in it.
    So for example having the rows:
    F1
    abc#1 ----> currently selected row
    cde#2
    efg#3
    I want to change the background color to all the F1 fields which have a "1" after the '#' and let the other "F1" row cells background color stay unchanged.
    But as you can imagine, the InlineStyle affect the "F1" background color in all the rows (assuming that the first row of the table is selected).
    So the question: how to access a single cell of a row in an ADF table, and programmatically change its background color ?
    So far I can iterate through the ADF table with:
    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("aTableIterator");//access the iterator by its ID value in the PageDef file
    RowSetIterator rsi = dciter.getRowSetIterator();
    System.out.println("rsi getrowcount = " rsi.getRowCount());+
    Row row = null;
    +if (rsi.getRowCount() > 0) {+
    row = rsi.getCurrentRow();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    System.out.println("class : " row.getAttribute("F1").getClass().toString());+
    +}+
    +while (rsi.hasNext()) {+
    row = rsi.next();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    +}+
    Regards,
    Sergio.

    Hi,
    I mean a specific cell within a row.
    Here are two pictures that show an ADF table with two rows and some fields on it:
    https://skydrive.live.com/?cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents#cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents
    bild_A is what I have, bild_B is what I would like. Note that:
    in bild_A the first row contain a yellow background color for the field F4 and an orange background color for the field F5. This is correct, because F4 has an "1" at the end of its string value, and F5 has a "3" at the end. So far so good.
    But the second row (again, bild_A) has also the fields F4 with yellow background color, and the field F5 with orange background color, even if the value in both fields is 0.
    What is should be, is shown in bild_B.
    The problem is that the solution provided affects all the cells of the column, while I need to change the background color of a single cell, and leave the other unchanged (see bild_B).
    I hope that clarify a bit :)
    Sergio.

Maybe you are looking for

  • Can I play sound through IPad but watch the video through TV ?

    I want to play sound through IPad but watch the video through TV  using Apple TV Is that possible ?

  • Need help adding jstrings to jobjectArray

    I'm trying to add jstrings to a jobjectArray, but I keep getting ArrayStoreExceptions, and I can't figure out why. The array is declared here: jclass strArrCls = (*env)->FindClass(env, "[Ljava/lang/String;"); apiData = (*env)->NewObjectArray(env, 24,

  • Related to Excise & AR Invoice

    Hi Dears, I've created one GRPO for excisable item and created the Incoming excise invoice also.Now if i created AR invoice it is going for approval and after approval when i add this document it is giving the message ''create excise invoice first''

  • Crashes with Mac Pro and Wacom Cintiq?

    Anyone else here running a Mac Pro with a Wacom Cintiq? I am having issues with this configuration since I updated to 10.5.3. Mac OS X would crash while I am using the Cintiq. I have an 8-Core Mac Pro (Early 2008) with the stock ATI Radeon HD 2600 XT

  • Can't find a store with retina, what about the non retina?

    I had decided to get a retina MacBook Pro earlier, but I have grown tired of never finding them in the stores. Now I am wondering if the non retina would be the best way to go. Any opinions would be appreciated.