PDA

View Full Version : Add circles to line chart programmaticly



taberg
24 Dec 2011, 4:33 PM
Hi!

I am so happy with the new charts in Sencha!

But i want to highlight some points on the line chart, i can extract whether the highlight should exist or not from the store (as long as i keep track of where on the line i am).

I have tried the on render handler, also tried to make it work with the on mouse over...

preferably i want to render the circles while the line is rendered (and re rendered in case of resizing the window)

I have not really figured the sprites out, cause i guess that is where i should look. how would you guys solve it?

Also... I suck att programming, the page looks like i want it... but under the hood it's a mess. The page will not load in IE, and i cant figure out why. If anyone wants to try it, it's at:

www.tabergconsulting.com/insyn/index.html


Thank you very much!

Tomas

mitchellsimoens
25 Dec 2011, 6:08 AM
If it loads under Firefox/Chrome and not IE, usually an extra comma is to blame.

About drawing a circle to highlight something in a chart, yes, a sprite would be your best bet.

taberg
25 Dec 2011, 8:10 AM
I've been going through the code, found some lines without ;'s and some with extra ,'s... using mac, will try IE again.

So.. how would i find the correct sprites in the best way? via onrender on the chart? can i use on render on the series? i am stuck...

tomas

taberg
2 Jan 2012, 10:26 AM
some code similar to this:


tips: {
trackMouse: true,
width: 200,
height: 28,

renderer: function(klass, item) {
var storeItem = item.storeItem;

if(storeItem.get('lText') != ""){
data=JSON.parse(storeItem.get('lText'));
chartTipStore.loadData(data);
}
this.setTitle(Ext.util.Format.date(item.storeItem.get('Date'),'Y-m-d') + ': ' + item.storeItem.get('Close') + ' kr');
}
}

where, if the if statement that checks if the store contains lText would also render a "marker" for that particular point on the line chart.

It is probably better to do this in the render function for the chart than for the Tips...

But just have a lack in knowledge.. any help is welcome!

Tomas

taberg
11 Mar 2012, 2:44 PM
bump!

have had some vacation time from the project... will need to rewrite the whole thing. there are no trailing comas... it wont load under IE.


But the sprites are the main thing here. Does anyone have any suggestions? Help is greatly apreciated!

Tomas