View Full Version : Use chart and slider in one panel

15 May 2012, 9:11 AM
I have a chart and slider in a panel that work together. In order for the slider to be initialized, the chart has to be rendered because the slider uses the labels on the x-axis and these labels are not generated untill the chart is rendered (Correct me If I am wrong here and there is a way to build the labels without rendering the chart)

In order to render the chart, I call panel.doLayout() on the container panel which contains the chart and the slider.

What do I need to do so that it will redraw the panel which means it draws the chart and the slider.

Calling panel.doLayout() again does not do anything.

I am using ExtJS 4.1.0

15 May 2012, 12:49 PM
Can you render the chart, and use the afterRender event to gather the labels, then create the slider?


15 May 2012, 1:03 PM
I am doing exactly as you stated. After I create the slider in the afterrenderer method, I don't see the slider in the panel. The only thing I see is the chart.

15 May 2012, 1:42 PM
What is your layout for rendering chart/slider? Do you have a place reserved for the slider?


15 May 2012, 1:50 PM
It is a container with a vertical box layout.

this._component = Ext.create('Ext.container.Container', {
flex:(this._flex || 1),
layout:(this._layout || {type:"vbox", align:"stretch"}),
listeners: {
afterrender: this._panelAfterRender,
afterLayout: this._panelAfterLayout,
resize: this.panelResize
// Here is the code to add the slider to the container.
chartSlider.setPosition(chartSlider.x - 10, chartSlider.y);