问题
I am using Sencha Touch charts 1.0.0 for my project. I would like to add values on each bar in the column chart. Is is possible to do ?
For example, see the image: I would like to add the values for each bar.
Any help appreciated.
回答1:
just add this in yoour series config
label: {
display: 'outside',
field: 'score',
orientation: 'horizontal', // 'vertical'
text-anchor': 'middle'
}
回答2:
Label config is not work for me.
I used labelField:'comedy'
in series it work.
回答3:
Came across this problem and found this solution didn't work. I'm using Touch Charts 2.0
This does work:
labelField: 'MyDataValue'
However, this does not work:
label: {
display: 'outside',
field: 'score',
orientation: 'horizontal', // 'vertical'
text-anchor': 'middle'
}
According to Sencha 2.2.1 docs (latest at time of writing), the default for label config is:
label: {
textBaseline: 'middle',
textAlign: 'center',
font: '14px Helvetica'
}
This suggests slightly different formatting params to those suggested by Nag. Maybe this is a change since v 1.x or it may to do with differences between Touch and ExtJS Anyway - hope it helps someone.
来源:https://stackoverflow.com/questions/9612725/sencha-touch-chart-how-to-add-label-value-in-column-chart