How to chart legend background is transparent?

  1. #1

    How to chart legend background is transparent?

    Click image for larger version. 

Name:	chart_legend.png 
Views:	4 
Size:	18.7 KB 
ID:	25189

    How to chart legend background is transparent in c#?


    i tried this code.

    chart.LegendConfig.StyleSpec = "background:transparent"

    but there was no change.
  2. #2
    Hello @meka123, and welcome to Ext.NET forums!

    You have just to get the right CSS class to override. Here's a somewhat recent discussion on this topic, all you have to change is from border to background, or down one level in the CSS hierarchy.

    - Chart legend problem

    For CSS overriding to work you need to use the default legend (not SpriteLegend which is rendered within the chart canvas).

    Unfortunately the way the themes are written caused this issue where you can't override the legend CSS settings from the C# definitions like you pointed, so using the CSS override was the best way we found to overcome this issue at the time the discussion above took place.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I looked up all the threads but could not resolve.

    I had tried the following css code:

    .x-legend-container {
    background: transparent;
    }

    But there was no change.

    I tried to open the html script in Chrome.

    Click image for larger version. 

Name:	chart_legend_html.png 
Views:	2 
Size:	11.0 KB 
ID:	25190

    I fell into confusion.

    There was only a canvas tag.

    What should I do?
  4. #4
    Hello @meka123!

    Try using LegendDomConfig instead of LegendConfig. By default it uses the SpriteLegend as suggested above.

    Would you mind editing your last post wrapping code within [code][/code] tags? It gets much better for reading and understanding your code snippets.

    Hope this helps, and thanks in advance!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    I have tried using LegendDomConfig.
    Then I saw the tag of the legend.
    So I modified it using the css.

    Thanks.

Similar Threads

  1. [CLOSED] Set background of Panel to transparent
    By supera in forum 2.x Premium Help
    Replies: 4
    Last Post: Mar 01, 2013, 12:57 PM
  2. [CLOSED] Chart.Legend background color ?
    By Zenalyse in forum 2.x Premium Help
    Replies: 1
    Last Post: Feb 19, 2013, 2:57 PM
  3. [CLOSED] Window transparent background.
    By alainfo in forum 1.x Premium Help
    Replies: 4
    Last Post: Jun 17, 2010, 10:24 AM
  4. iframe transparent background
    By pintun in forum 1.x Help
    Replies: 1
    Last Post: Nov 05, 2009, 2:50 PM
  5. Replies: 2
    Last Post: Jan 07, 2009, 11:33 AM

Tags for this Thread

Posting Permissions