extjs - Display a different text in Legend -
This version is about 4.2.2. We have such a chart
var store = 'Ext.data.JsonStore', {fields: ['name', 'data'], data: [{'name': 'metric one', 'data': 10}, {'name': ' Metric two ',' data ': 27}]}); Extension. ('Ext.chart.Chart', {renderTo: Ext.getBody ()), width: 500, height: 300, animate: true, store: archive, legend: {status: 'right'}, axis: [{type : 'Numeric', position: 'left', field: ['data'], label: {renderer: Ext.util.Format.numberRenderer ('0,0')}, Title: 'Sample Value', Grid: [ {Type: 'column', axis: true, minimum: 0}, {type: 'category', position: 'bottom', fields: ['name'], title: 'sample metrics'}], series:' Left Highlight: true, suggestion: {trackmouse: true, width: 140, height: 28, renderer: function (store item, item) {this.setTitle (storeItem.get ('name') + ':' + storeItem ('Data') + '$');}}, label: {Display: 'inside', 'text-anchor': 'middle', field: 'data', renderer: extension. North.format.NumberRender ('0'), Orientation: 'vertical', color: '# 333' }, Exfield: 'name', 'WiFiild:' data '}]}); But the legend only displays the field name which is not quite useful. We need to implement a custom value that should be typed steady. But we have not got anything to do. There is a showInLegend property but we did not find any legendtext or displayText support which can allow us to change with this name, this In the case of to code> extensions. ({Name: 'fiddle', launch: function () {var store = Ext.create ('Ext.data.JsonStore', {fields: ['name', 'data', 'data2'], data: [ 'Name': 'metric one', 'data': 10, 'data2': 2}, {'name': 'metric two', 'data': 27, 'data2': 5}]}); Ext .create ('Ext.chart.Chart', {rendersTo: Ext.getBody (), width: 500, height: 300, Animate: true, store: store, legend: {status: 'right'}, letters: [ Type: 'numeric', position: 'left', field: ['data', 'data2'], label: {renderer: Ext.util.Format.numberRenderer ('0,0')}, title: 'Sample Value ', grid: true, minimum: 0}, {type:' category ', position:' bottom ', field: [' name '], top : [Trackmaster: true, width: 140, height: 28, renderer: 'sample matrix'}], series: [{typ e: 'column', axis: 'left', highlight: true, stacked: true; Function (store item, item) {this.setTitle (get storeItem. ('Name') + ':' + storeItem.get ('data') + '$');}}, label: {display: 'inside End ',' text-anchor ':' medium ', field:' data ', renderer: extensions.ttil.form.numberrender (' 0 '), orientation:' vertical ', color:' # 333 '}, Exfield: 'Name', WiFiild: ['Data', 'Data2'], Title: 'Your Nublabel'}]}); }});
to replace title in legend Check the label that I've created for your example code. series: [{type: 'column', axis: 'left', highlight: correct, suggestion: {trackMouse: true, width: 140, height: 28, renderer: function ( Store item, item) {this.setTitle (storeItem.get ('name') + ':' + storeItem.get ('data') + '$'); }}, Label: {display: 'inside end', 'text-anchor': 'medium', field: 'data', renderer: extensions.ttil.form.numberrender ('0'), orientation: 'vertical' Color: '# 333'}, Exfield: 'name', 'WiFiild:' data, title: 'your newlabel'} update : If you have a array of a title related to the Multiple fields, for example: Title: ['My First Field', 'My Second Field'] This is a
Comments
Post a Comment