Hybrid View

    You found a bug! We've classified it as EXTGWT-3286 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    5
    Vote Rating
    1
    cassianofaria is on a distinguished road

      1  

    Default GXT Chart with BarSeries generates a invalid SVG (rect without height)

    Hello all,

    We found a problem when we use BarSeries in Chart.

    When the series has a big diference between values, the scala makes the minor value disappear completely in chart. This only happens when the BarSeries is configured to column.

    In this case, the rect that represents that value in chart will be inserted with height 0.
    That causes a lot of problems, mainly when you use some framework as Batik to export the generated SVG to a Image.

    The problem is in class com.sencha.gxt.chart.client.chart.series.BarSerie, line 788, version 3.0.1:
    PHP Code:
    rect.setHeight(Math.max(rect.getHeight() - diff0)); 
    When the max value is zero, the rect isn't in SVG.
    A possible workaround is change the line to:
    PHP Code:
    rect.setHeight(Math.max(rect.getHeight() - diff0.1)); 
    Was this problem reported before?
    Is there another workaround?

    Regards,
    Cassiano Faria.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default

    Thanks for the report! I have opened a new bug in the tracker, though I think that any fix for this will also affect http://www.sencha.com/forum/showthread.php?255584 and vice versa.

  3. #3
    Sencha User
    Join Date
    Dec 2015
    Posts
    0
    Vote Rating
    0
    BrindaMurali is on a distinguished road

      0  

    Default

    Hi Cassiano Faria/,have you found any work around for SVG having no height attribute when there is minor value for the column ?
    Update: Seems like there is a workaround for this issue .
    Following is the workaround:
    • Check whether the height is 0 on render of the column/bar
    • if height is 0 we have put the height attribute to 1 or any other minimum possible
    • gave the column color as the background color which is white in our case
    code is as follows
    column.setRenderer(new SeriesRenderer<ModelData>() {
    @Override
    public void spriteRenderer(Sprite sprite, int index, ListStore<ModelData> store) {
    RectangleSprite s = ((RectangleSprite) sprite);


    // If height is 0, set the color to transparent and height to min 1, to arrest pdf error.
    if (s.getHeight() <= 1.0){
    s.setHeight(1);
    s.setFill(new Color("#ffffff"));
    }
    }
    });