1. #11
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    88
    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

      0  

    Default


    Right. That's why my comment was about in my original post:
    Code:
          public void spriteRenderer(Sprite sprite, int index, ListStore<Data> store) {
            ((RectangleSprite)sprite).setWidth(myWidth);
            //TODO get the original width and x position and modify the x position
            //to properly center the bar around the tick mark
            sprite.redraw();
          }
    The original position is based on the old width. Get the current offset, add half the old width, then subtract half the new width to re-center correctly.

    If you want more specifics, you'll need to post some code.

  2. #12
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Vote Rating
    0
    onentwoo is on a distinguished road

      0  

    Default


    Hi
    Thanx for the suggestion it worked (only since i use horizontal stack bar i work with the height instead of the width).
    The only issue left is that the axis ticks are still getting the space between them again according to the number of bars.
    According to your calculation i can put the bars right on the axis ticks, but the space itself between the tick is getting bigger or smaller according to the number of bars
    (i.e. when having 2 bars a big space between ticks, when having many bars space is very small)
    Is there a way also to make the tick to have the same space size between them and if it doesn't have a place just add a scroll bar ?

  3. #13
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    88
    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

      0  

    Default


    The only issue left is that the axis ticks are still getting the space between them again according to the number of bars.
    According to your calculation i can put the bars right on the axis ticks, but the space itself between the tick is getting bigger or smaller according to the number of bars
    (i.e. when having 2 bars a big space between ticks, when having many bars space is very small)
    The space between the bars cannot be based on the *width* of the bars, but instead based on how much space is available (how big the chart is) divided by the number of bars. Otherwise all bars would be clumped together, leaving lots of empty space to one side or the other (or both). If there is too much dead space, why not make the chart smaller...?

    Is there a way also to make the tick to have the same space size between them and if it doesn't have a place just add a scroll bar ?
    I'm not sure I understand the request, but there is no way to create scrollbars inside the charts, at least at present. There aren't nested containers in the draw system, its just one big draw area. You could make the chart's size based on how many groups you have and force the entire thing to have scrollbars - is that what you are asking? For more details, please try making a sample app using one of the examples at sencha.com/examples and tweaking it to demonstrate your use case.

  4. #14
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    5
    poseidonjm is on a distinguished road

      0  

    Default


    I do the next for my horizontal bar. You can change height to width for vertical bars.

    Code:
          bar.setShadowRenderer(new SeriesRenderer<PedidoPersonalEstadoFechaProxy>() {            
                @Override
                public void spriteRenderer(Sprite sprite, int index,
                        ListStore<PedidoPersonalEstadoFechaProxy> store) {
                    double myHeight = 40.0;
                    RectangleSprite s = ((RectangleSprite)sprite);
                    s.setY(s.getY() + s.getHeight()/2 - myHeight/2);
                    s.setHeight(myHeight);
                    
                    sprite.redraw();
                }
            });
            
            bar.setRenderer(new SeriesRenderer<PedidoPersonalEstadoFechaProxy>() {
                @Override
                public void spriteRenderer(Sprite sprite, int index, ListStore<PedidoPersonalEstadoFechaProxy> store) {
                    double myHeight = 40.0;
                    RectangleSprite s = ((RectangleSprite)sprite);
                    s.setY(s.getY() + s.getHeight()/2 - myHeight/2);
                    s.setHeight(myHeight);
                  sprite.redraw();
                }
              });