如何给动态轴的最小值和最大值从存储sencha触摸图表 [英] how to give dynamic axes minimum and maximum values to chart from store sencha touch

查看:139
本文介绍了如何给动态轴的最小值和最大值从存储sencha触摸图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xtype:chart,这是我的轴。

 轴:[{
type:'numeric',
minimum:0,
位置:'left',
fields:['2011','2012','2013'],
title:'Sales',
minorTickSteps:1,
grid: {
odd:{
opacity:1,
fill:'#ddd',
}
},
style:{
axisLine :
$ st $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b最大:1000
},{
type:'category',
position:'bottom',
fields:['name'],
title:'
样式:$ {
estStepSize:1,
stroke:'#999'
}
}]

这是我的问题,最小值和最大值va在不同的用户之间进行了很多。如果我给一些用户最小为-0,最大为10000,那么图表不会显示出来。对于其他一些图表,如果我做了0 -1000,则不会显示,所以我想改变这个最小值和加载图表之前存储的最大值。有没有这样做的可能性?我要求一个例子。感谢你

解决方案

无需设置最小和最大值,因为它将由sencha基于数据



如果你仍然想做,那么可以通过收听图表的初始化事件来做到这一点。



让我们说,这个是轴

 轴:[{
type:'numeric',
position:'left'
fields:['data1'],
title:{
text:'Sample Values',
fontSize:15
},
grid:true ,
minimum:0
},{
type:'category',
position:'bottom',
fields:['name'],
标题:{
text:'Sample Values',
fontSize:15
}
}],

并初始化监听器

 监听器:{
initialize:function (我,eO pts){
Ext.getStore('chartstore')。load({
callback:function(records,operation,success){
var data = records [0] .data;
var axes = me.getAxes();
var SampleValuesAxis = axes [0];
SampleValuesAxis.setMinimum(data.minimum);
SampleValuesAxis.setMaximum(data.maximum);
},
范围:this
});
}
}


I am using xtype:chart and this is my axes.

   axes: [{
      type: 'numeric',
      minimum: 0,
      position: 'left',
      fields: ['2011', '2012', '2013'],
      title: 'Sales',
      minorTickSteps: 1,
      grid: {
              odd: {
                      opacity: 1,
                      fill: '#ddd',
              }
      },
      style: {
              axisLine: false,
              estStepSize: 20,
              stroke: '#ddd',
              'stroke-width': 0.5
      },
      minimum: 0,
      maximum: 1000
  }, {
      type: 'category',
      position: 'bottom',
      fields: ['name'],
      title: 'Month of the Year',
      style: {
              estStepSize: 1,
              stroke: '#999'
      }
 }]

Here is my problem, minimum and maximum values varying a lot between different users.Like the chart does not showup if I give minimum -0 and maximum as 10000 for some users..and for some other chart does not show if I make 0 -1000, so I want to change that minimum and maximum values from the store before the chart is loaded. is there any possibility of doing that ?? I request an example .Thank you

解决方案

No need to set minimum and maximum because it will be set by sencha based on data

If you still want to do then can do that by listening to initialize event of chart

Lets say, this is axes

axes: [{
        type: 'numeric',
        position: 'left',
        fields: ['data1'],
        title: {
            text: 'Sample Values',
            fontSize: 15
        },
        grid: true,
        minimum: 0
    }, {
        type: 'category',
        position: 'bottom',
        fields: ['name'],
        title: {
            text: 'Sample Values',
            fontSize: 15
        }
    }],

And initialize listener

    listeners : {
        initialize : function( me, eOpts ) {
            Ext.getStore('chartstore').load({
                callback: function(records, operation, success) {
                var data = records[0].data;
                 var axes = me.getAxes();
                 var SampleValuesAxis =  axes[0];
                    SampleValuesAxis.setMinimum(data.minimum);
                    SampleValuesAxis.setMaximum(data.maximum);
            },
            scope: this
        });
       }
   }

这篇关于如何给动态轴的最小值和最大值从存储sencha触摸图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆