jqplot - 如何将第一个X轴设置为0

3

我正在使用jqplot绘制一些图表。

但是我想将第一个X轴设置为0。

我的源代码如下:

plot = $.jqplot(idTag, data, options);

请问我如何在[options]参数中设置第一个X轴为0?

这是我的数据:

var _DATA_CHART2 = {"chart2": {
               "display_labels" : 1,
               "data": [
                       {
                               "period": "0",
                               "medicine_name": "GL",
                               "dosage": "100",
                               "test_value": "220",
                               "test_date": "2013/01/02",
                               "drugs_name": "AMP",
                               'of_prescribing' : '12'
                       },
                       {
                               "period": "2",
                               "medicine_name": "GL",
                               "dosage": "130",
                               "test_value": "200",
                               "test_date": "2013/01/06",
                               "drugs_name": "AMP",
                               'of_prescribing' : '13ca'
                       },
                       {
                               "period": "4",
                               "medicine_name": "GL",
                               "dosage": "100",
                               "test_value": "200",
                               "test_date": "2013/01/10",
                               "drugs_name": "ACP",
                               'of_prescribing' : '142'
                       }
               ]
               }};

var categoryX = [ [1 , '3M'],[2 , '6M'],[4 , '12M'],[6 , '18M'],[8 , '24M'],[10 , '30M'],] ;

var categoryY = [[-120, ' '],[0, 'CMR'],['', ' '],
    ['', ' '],['', ' '],['', ' '],
    ['', ' '],[100, 'MMR'],['', ' '],
    ['', ' '],['', ' '],['', ' '],
    [190, 'CCyR'],[199, 'PCyR(Ph+<=35%)'],
    [206, 'Minor CyR(Ph+<=65%)'],[215, 'CHR'],
    [220, ' ']
];
2个回答

0
        var line1 = [[0, 7], [9, 14], [14, -1], [19, -1], [23, 11], [25, -1]];
        var plot2 = $.jqplot('chart1', [line1], {
           title: 'Stuff ', 
           axes:{                  
               xaxis: {min:0}              
           }
        });

0
使用axesDefaultsseriesDefaults。那么,如果您想要x轴和y轴都从0开始,并且希望所有系列都不显示标记,您可以这样做:
optionsObj = {axesDefaults:{min:0}, seriesDefaults:{showMarker:false}}

1
感谢MustafaP!但是它没有成功。 - kaká

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接