[CLOSED] Changing Chart Background Color

  1. #1

    [CLOSED] Changing Chart Background Color

    I have added a menuItem that allows the user to select the background color of the chart. Do I need to tell the chart to redraw because the new color is not showing up?

       <ext:MenuItem runat="server" Text="Background Color" Icon="ColorSwatch">
          <Menu>
             <ext:ColorMenu runat="server">
                <Listeners>
                   <Select Handler="Ext.getCmp('CrtsChart').background.fill = '#' + color;" />
                </Listeners>
             </ext:ColorMenu>
          </Menu>
       </ext:MenuItem>
    Last edited by Daniil; Nov 22, 2013 at 11:00 AM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    To change it on the fly, please do this:
    App.Chart1.surface.background.setAttributes({
        fill: "red"
    }, true);
  3. #3
    Works great ...

    Comment:

    I create my chart in behind code and originally did not define Background and everything worked. But to set the color in the listener I needed to define background and set fill in my behind code otherwise it is undefined when I try to set it in the listener.

       Chart Chart1 = new Chart();
       Chart1.ID = "CrtsChart";
       ...
       Chart1.Background = new DrawBackground();
       Chart1.Background.Fill = "white";
       ...
    Question:

    Is there a way to set the initial value of the ext:ColorMenu in the markup?
     <ext:MenuItem runat="server" Text="Background Color" Icon="ColorSwatch">
        <Menu>
           <ext:ColorMenu runat="server">
              <Listeners>
                 <Select Handler="Ext.getCmp('CrtsChart').background.fill = '#' + color;" />
              </Listeners>
           </ext:ColorMenu>
        </Menu>
     </ext:MenuItem> 
    .
    Last edited by cwolcott; Nov 22, 2013 at 9:45 AM.
  4. #4
    Here you are.
    <ext:ColorMenu runat="server">
        <Picker Value="FFFFFF" />   
    </ext:ColorMenu>
  5. #5
    Please close the thread.

Similar Threads

  1. [CLOSED] Chart.Legend background color ?
    By Zenalyse in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 19, 2013, 1:57 PM
  2. Replies: 7
    Last Post: Jul 11, 2012, 1:12 PM
  3. [CLOSED] Changing the background color of htmleditor
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 18, 2012, 5:41 PM
  4. Changing TreePanel background color
    By wexman in forum 1.x Help
    Replies: 3
    Last Post: Apr 06, 2011, 2:35 PM
  5. [CLOSED] Changing background color of TabPanel on the fly
    By rmelancon in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 07, 2010, 12:23 PM

Posting Permissions