[CLOSED] Update chart color set

  1. #1

    [CLOSED] Update chart color set

    Hello,

    I am using custom color set for charts and setting them as below in code behind. MyColorSet is array of strings.

    (MyChart.Series[0] as PieSeries).ColorSet = MyColorSet;
    Above code works fine during page load. When I re-load chart store with different values, I need to change the color set if necessary. By the way, the chart color set is not updated with above code during server side ajax call (direct method). Do you have a suggestion on the issue?

    Thanks.
    Last edited by Daniil; Jun 18, 2013 at 2:03 PM. Reason: [CLOSED]
  2. #2
    Hi @bayoglu,

    I think such a change requires redrawing a chart. Please try:
    Chart1.Redraw();
  3. #3
    Hello Daniil, thanks for your support. I already tried .Redraw() with no change. I could make it work as below. Do you have a suggestion on this?

    Thanks.

                    if (X.IsAjaxRequest)
                    {
                        MyChart.Set("assignedColors", MyColorSet);
                        MyChart.AddScript("{0}.series.items[0].colorSet={0}.assignedColors;", MyChart.ClientID);
                    }
                    else
                    {
                        MySeries.ColorSet = ResidualGaugeColorSet;
                    }  
                    MyChart.Series.Add(MySeries);
  4. #4
    You are right.

    A bit easier, you can replace
    MyChart.Set("assignedColors", MyColorSet);MyChart.AddScript("{0}.series.items[0].colorSet={0}.assignedColors;", MyChart.ClientID);
    with
    MyChart.Set("series.items[0].colorSet", MyColorSet);
    But redrawing is required, anyway.
  5. #5
    Hi Daniil,

    Thanks for the shortcut. You saved an extra custom config for me (; Please mark as closed.

Similar Threads

  1. [OPEN] [#252] Axis color in Chart
    By livehealthierGF in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: May 29, 2013, 3:54 AM
  2. [OPEN] [#211] Chart color set
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 16, 2013, 3:05 PM
  3. [CLOSED] Chart: Gauge color
    By tanky65 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 08, 2013, 8:42 AM
  4. [CLOSED] Chart.Legend background color ?
    By Zenalyse in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 19, 2013, 1:57 PM
  5. [CLOSED] How can change color for only one chart column
    By tactime10 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 12, 2013, 8:08 AM

Posting Permissions