Results 1 to 2 of 2

Thread: Problems updating sprites from bar chart

  1. #1

    Default Problems updating sprites from bar chart

    Morning,
    I've got problems updating the number of necessary sprites in a bar chart.
    I introduce you how we implemented this chart (working in ExtJs 4.2 and having this problem with 6.2 migration).
    We defined a view that extends a CartesianChart with these specification:

    store: {
    type: 'store'
    },
    axes: [{
    type: 'numeric',
    position: 'left',
    title: false,
    grid: true
    }, {
    type: 'category',
    position: 'bottom',
    fields: ['t'],
    title: false,
    hidden: true
    }],
    series: [
    {
    type: 'bar',
    axis: 'left',
    xField: 't',
    stacked: true,
    xPadding: 15,
    style: {
    maxBarWidth : 40,
    minGapWidth: 20,
    maxGapWidth: 20,
    },
    renderer: 'changeBarSeriesColor'
    },
    {
    type: 'line',
    showMarkers: false,
    xField: 't',
    renderer: 'changeLineSeriesColor',
    style: {
    lineWidth: 3
    }
    },
    {
    type: 'line',
    showMarkers: false,
    xField: 't',
    renderer: 'changeLineSeriesColor',
    style: {
    lineWidth: 3
    }
    }
    ],

    then we have a init component function where we add two event listeners. One of them is 'datachanged' because the data that we paint in chart is from a store in grid (but pay attention, we don't link these two stores, i will explain how we load this new changed data) and its suppose we have to refresh the chart with this new data. The second listener is about a color picker that we show to user to change color of sprites in bar.
    When first event is fired, we take the number the rows from the grid (our Yfields from bar) and we load dynamically:

    chart.series[0].setYField(gridStoreRows);

    It works perfectly when we are adding rows to this grid. Chart creates a sprite for every value of gridStoreRows (type array o strings)

    Then we take the data from store, and we push it to a new object data. Then we load it to chart by this way:

    chart.getStore().loadData(data);

    The problem is:
    - when we are adding rows, or editing values from existing rows there's any problem. Chart creates new sprites and data is loaded to chart, and chart updated and redrawed.
    - however, when we delete a row from grid, data object is correctly created:
    data.item[0] = { row1 : value, row2: value ....}
    but when we load dynamically the new yFields (gridStoreRow have a one less value) the sprites doesn't change. We load data as previosly, the chart is updated and redrawed and something also happens visually:

    resources.PNG

    Yaxis is correctly changed values, but a piece os sprite is still showed. I don't know why, and how I tell before, chart still has 3 sprite into its structure chart.getSeries()[0].getSprites()

    Why? Isn't extjs charts ready for remove sprites from bar charts? or I'm doing something wrong?

    Thanks u!

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    The upgrade from 4.2. to 5.x came with a separate upgrade guide for charts, in case you haven't seen it:
    http://docs.sencha.com/extjs/5.0.0/g...ade_guide.html

    Your post is well-written but I'm not seeing which sprite shouldn't be rendering. If this is still an issue, can you specify how it should appear?

Similar Threads

  1. Chart series.destroy() not removing sprites
    By arahlf in forum Sencha Touch 2.x: Bugs
    Replies: 1
    Last Post: 1 Jul 2014, 10:29 PM
  2. Adding additional sprites to GXT chart
    By rbrecheis in forum Sencha GXT Q&A
    Replies: 0
    Last Post: 14 Jan 2013, 6:19 AM
  3. Replies: 0
    Last Post: 6 Aug 2012, 12:22 AM
  4. Replies: 0
    Last Post: 13 Jun 2012, 6:39 AM
  5. Updating hidden charts causes chart problems
    By defcon1 in forum Ext: Discussion
    Replies: 10
    Last Post: 18 Nov 2011, 12:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •