代码之家  ›  专栏  ›  技术社区  ›  Dr. Rajesh Rolen

用jqPlot在图表右侧显示Y轴

  •  1
  • Dr. Rajesh Rolen  · 技术社区  · 14 年前

    $.jqplot.config.enablePlugins = true;
    
            var test2 = readXML(posi);
    
            plot2 = $.jqplot('chart2', [test2], {
                series: [{ renderer: $.jqplot.OHLCRenderer, rendererOptions: { candleStick: true, wickColor: '282828',
                    upBodyColor: '00C000', fillUpBody: true, downBodyColor: 'F81700',
                    fillDownBody: true, lineWidth: 1.5, tickLength: true, background: 'C8C8C6',
                    closeColor: '282828', openColor: '282828'
                }
                }, { xaxis: 'x2axis', yaxis: 'y2axis'}],
                axesDefaults: {
                    tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                    tickOptions: {
                        angle: 30
                    }
                },
                axes: {
                    xaxis: {
                        renderer: $.jqplot.CategoryAxisRenderer
                    },
                    x2axis: {
                        renderer: $.jqplot.CategoryAxisRenderer
                    },
                    yaxis: {
                        autoscale: true
                    },
                    y2axis: {
                        autoscale: true
                    }
                }
            });
    

    请告诉我我错在哪里。

    我从参考资料中得到了上述代码: http://www.jqplot.com/tests/canvasAxisTests.php 在本例中,第三个示例显示右侧的值。我用的是jqPlot的烛台图。

    1 回复  |  直到 14 年前
        1
  •  0
  •   Alex    14 年前

    看看jqplot附带的CSS文件。它定义了jqplot yaxis的设置,因此您可以使用它来设置所需的位置。