PDA

View Full Version : [CLOSED] id chart object



tactime10
Oct 17, 2012, 12:32 PM
Hi,

I set my code as below



var onMouseUp = function (item) {
var series = App.chartAnalysis.series.get(0),
index = Ext.Array.indexOf(series.items, item);
selectedStoreItem = item.storeItem;
App.direct.OnItemMouseUp(selectedStoreItem.get('pa rtNumber'),index);
};


Into the method OnItemMouseUp I create the new chart. when I click on the chart created dinamically this function generate the new one.
I need to know the id the chart object then I want that the "chartAnalysis" in following string "App.chartAnalysis.series.get(0)"
becomes variable.

How can do for this issue?

Which are the parameters for this function? only "item" ?

Thank you so much.

Daniil
Oct 17, 2012, 3:01 PM
Hi @tactime10,

Yes, there is but "item" argument. You can get a chart id this way:

item.series.chart.id

Also you can use a scope that refers to a series instance.

this.chart.id

tactime10
Oct 17, 2012, 4:31 PM
I replaced the following string

var series = App.chartAnalysis.series.get(0),
with this


var chartElement = this.chart.id;
var series = chartElement.series.get(0),

into the function below


var onMouseUp = function (item) {
var chartElement = this.chart.id;
var series = chartElement.series.get(0),
index = Ext.Array.indexOf(series.items, item);
selectedStoreItem = item.storeItem;
App.direct.OnItemMouseUp(selectedStoreItem.get('pa rtNumber'),index);
};

but now the click on the column it doesn't work, I think there is an error in this changement.
Can you suggest me any things?

Thank you so much for your patience.

Daniil
Oct 17, 2012, 7:13 PM
Well, I think you can use just

var series = this;
or

var series = item;

tactime10
Oct 18, 2012, 3:52 PM
ok,

with the "var series = this" the function work, instead with the last string that you suggest it doesn't work

Thanks.

Daniil
Oct 18, 2012, 7:31 PM
My fault. This should work.

var series = item.series;

tactime10
Oct 19, 2012, 8:42 AM
ok,

also in this way the function work.

Thanks.