Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 多字段折线图_Javascript_Extjs_Extjs4.1 - Fatal编程技术网

Javascript 多字段折线图

Javascript 多字段折线图,javascript,extjs,extjs4.1,Javascript,Extjs,Extjs4.1,我试图模仿链接中提供的图表 使用我的定制数据。我得到的图表是日期v/s温度。但我在图表上看不到t1字段的折线图 谁能帮我找出错误吗 var storea = Ext.create('Ext.data.Store', { model: 'WeatherPoint', data: [ { temperature: 58, t1 : 23, date: new Date(2013, 1, 1, 8) }, { tempe

我试图模仿链接中提供的图表

使用我的定制数据。我得到的图表是日期v/s温度。但我在图表上看不到t1字段的折线图

谁能帮我找出错误吗

 var storea = Ext.create('Ext.data.Store', {
        model: 'WeatherPoint',
        data: [
            { temperature: 58, t1 : 23, date: new Date(2013, 1, 1, 8) },
            { temperature: 63, t1 : 52, date: new Date(2013, 1, 1, 9) },
            { temperature: 73, t1 : 56, date: new Date(2013, 1, 1, 10) },
            { temperature: 78, t1 : 67, date: new Date(2013, 1, 1, 11) },
            { temperature: 81, t1 : 87, date: new Date(2013, 1, 1, 12) }
        ]
    });



var chart = Ext.create('Ext.chart.Chart', {
            style: 'background:#fff',
            animate: true,
            store: storea,
            shadow: true,
            theme: 'Category1',
            legend: {
                position: 'right'
            },
            axes: [{
                type: 'Numeric',
                minimum: 0,
                position: 'left',
                fields: ['temperature', 't1'],
                title: 'Number of Hits',
                minorTickSteps: 1,
                grid: {
                    odd: {
                        opacity: 1,
                        fill: '#ddd',
                        stroke: '#bbb',
                        'stroke-width': 0.5
                    }
                }
            }, {
                type: 'Category',
                position: 'bottom',
                fields: ['date'],
                title: 'Month of the Year'
            }],
            series: [{
                type: 'line',
                highlight: {
                    size: 7,
                    radius: 7
                },
                axis: 'left',
                xField: 'date',
                yField: 'temperature',
                markerConfig: {
                    type: 'cross',
                    size: 4,
                    radius: 4,
                    'stroke-width': 0
                }
            }, {
                type: 'line',
                highlight: {
                    size: 7,
                    radius: 7
                },
                axis: 'left',
                smooth: true,
                xField: 'date',
                yField: 't1',
                markerConfig: {
                    type: 'circle',
                    size: 4,
                    radius: 4,
                    'stroke-width': 0
                }
            }, {
                type: 'line',
                highlight: {
                    size: 7,
                    radius: 7
                },
                axis: 'left',
                smooth: true,
                fill: true,
                xField: 'name',
                yField: 'data3',
                markerConfig: {
                    type: 'circle',
                    size: 4,
                    radius: 4,
                    'stroke-width': 0
                }
            }]
        });


    var win = Ext.create('Ext.Window', {
        width: 800,
        height: 600,
        minHeight: 400,
        minWidth: 550,
        hidden: false,
        maximizable: true,
        title: 'Line Chart',
        renderTo: Ext.getBody(),
        layout: 'fit',
        tbar: [{
            text: 'Save Chart',
            handler: function() {
                Ext.MessageBox.confirm('Confirm Download', 'Would you like to download the chart as an image?', function(choice){
                    if(choice == 'yes'){
                        chart.save({
                            type: 'image/png'
                        });
                    }
                });
            }
        }, {
            text: 'Reload Data',
            handler: function() {
                // Add a short delay to prevent fast sequential clicks
                window.loadTask.delay(100, function() {
                    storea.loadData(generateData(8));
                });
            }
        }],
        items: chart
    });
这是我通过上述代码得到的结果:


当我向商店添加
字段:[“温度”、“t1”、“日期”],
时,它为我工作。

您的模型是否具有
t1
字段?@Jandalf是。t1是我的字段。如果每条记录的数据属性中都有此字段,您可以检查存储吗?