[CLOSED] Charts created in code behind

  1. #1

    [CLOSED] Charts created in code behind

    I have a panel defined that will hold a chart that I will create and recreate based on user options in code behind.

    <ext:Panel ID="ChartPanel" runat="server" layout="BorderLayout" >
       <Items>
       </Items>
    </ext:Panel>
    When creating the chart in the code behind I added it to the panel using
    private void BuildChart()
       {
       ...
       Ext.Net.Chart byMonthChart = new Chart()
       { ... }
       
       ChartPanel.Items.Add(byMonthChart);
       }
    But when I went to recreate the chart via BuildChart it would not update on the panel. After looking through a couple of threads I changed it to the following. Is this the correct way? I only want one chart showing in the panel? Do I need the clear or clean anything up before trying to add the chart?

    private void BuildChart()
       {
       ...
       Ext.Net.Chart byMonthChart = new Chart()
       { ... }
       byMonthChart.AddTo(ChartPanel);
       //ChartPanel.Items.Add(byMonthChart);
       }
    Last edited by Daniil; Oct 31, 2012 at 6:09 PM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    Is this the correct way?
    Generally, yes, you should render a Chart. An AddTo method does that.

    And again yes, you should clean.

    You can call
    ChartPanel.RemoveAll();
    or use a Replace method instead of an AddTo one.
  3. #3
    Perfect. Please close thread.

Similar Threads

  1. Color combobox created by code behind
    By xtremexploit in forum 1.x Help
    Replies: 9
    Last Post: Jul 19, 2013, 12:45 PM
  2. [CLOSED] Dropdownfield with a window created from code behind
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 23, 2012, 6:30 PM
  3. [CLOSED] I need to create charts from code behind, but how to?
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 06, 2012, 11:29 AM
  4. Replies: 0
    Last Post: Sep 06, 2011, 6:33 PM
  5. [CLOSED] get value of controls created in code-behind
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Sep 30, 2010, 3:07 PM

Posting Permissions