English 中文(简体)
在使用狗时添加X轴标签。 图表。 数据集
原标题:Adding x axis labels when using dojox.charting.DataSeries

I m 制作一本由书目组成的多霍线图。 项目FileRead 使用 do子储存。 图表。 数据集。 采用数据集构造的第三参数(价值)确定一种能够产生图表点的方法。 e.g.

function formatLineGraphItem(store,item) 
{   
    var o = {
        x: graphIndex++, 
        y: store.getValue(item, "fileSize"),
    };
    return o;
}

图表Index是每份账面值都加油的绝缘。 这使我有一张线图,显示数字数字。 罚款。

我也能够具体说明用的X轴标记,而不是图Index的数值,即基本数据仍为1,2,3,4 ,但标签将显示案文(在这种情况下,记录尺寸的时间)。

我可以这样做,在我打上海图时,把各种标签带入X星号,但这要求我通过数据了解我所掌握的价值。 e.g.

var dataSeriesConfig = {query: {id: "*"}};
var xAxisLabels = [{text:"2011-11-20",value:1},{text:"2011-11-21",value:2},{text:"2011-11-22",value:3}];

var chart1 = new dojox.charting.Chart("chart1");
chart1.addPlot("default", {type: "Lines", tension: "4"});
chart1.addAxis("x", {labels: xAxisLabels});
chart1.addAxis("y", {vertical: true});
chart1.addSeries("Values", new dojox.charting.DataSeries(dataStore, dataSeriesConfig, formatLineGraphItem));
chart1.render();

可以通过预设数据系列来创建XAxisLabels阵列,但并非单.。

是否有任何想法可以推广Line GraphItem方法,以提供轴心标签。 或者是否有任何文件说明目标 o能够包含哪些价值?

提前感谢!

问题回答

This will take a unix timestamp, multiply the value by 1000 (so that it has microseconds for JavaScript, and then pass the value to dojo date to format it). You shouldn t have any problems editing this to the format you need.

你举例说明了你的日期是“1”、“2”、“3”,这显然是错误的。 这些日期,因此,除非你回答你的问题,这是你所能做的。

 chart1.addAxis("x",{
            labelFunc: function(n){              
                if(isNaN(dojo.number.parse(n)) || dojo.number.parse(n) % 1 != 0){
                    return " ";
                }
                else {
                    // I am assuming that your timestamp needs to be multiplied by 1000. 
                    var date = new Date(dojo.number.parse(n) * 1000);
                    return dojo.date.locale.format(date,  {
                        selector: "date",
                        datePattern: "dd MMMM",
                        locale: "en"
                    });
                }
            },
            maxLabelSize: 100
        }




相关问题
Get Dojo Radio Button Value?

I have an HTML form using dojo and have the following code for a radio button selection choice: dojo.require("dijit.form.RadioButton"); <link href="http://ajax.googleapis.com/ajax/libs/dojo/1....

is it possible to know if a dijit is displayed or not?

i have two divs on a page. each has several dijits. i have atoggle that shows only one div or the other. when i submit the form, i only want to validate the dijits that are in the div that is ...

dijit BorderContainer auto-grow

Is there a way to have a dijit.layout.BorderContainer auto-grow in height? I ve tried setting min-height: 200px; height: auto;, but it won t scale. I ve tried looking at the API, but that thing is a ...

Dojo Tabs as Custom Widgets

I ve created a number of widgets that are loaded as tab panes in a tabcontainer. Everything seems to work well, except I m getting different results when using my custom widgets vs. creating ...

What happened to Dojo DOH?

The Dojo Toolkit used to come with a testing facility called "Doh". It was in the /utils directory. Now when you download dojo-release-1.3.2 the /utils directory is nowhere to be found. Is Doh dead ...

热门标签