2

我正在尝试使用 ' '将jqPlot图表的长标签/刻度分成多行,但一切都是徒劳的。任何人都可以提出什么问题?<br>\n

将标签分成多行的最佳方法是什么?

  <script language="javascript" type="text/javascript" src="jqPlot/jquery.jqplot.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.barRenderer.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.highlighter.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.cursor.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.categoryAxisRenderer.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.canvasAxisTickRenderer.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.canvasTextRenderer.min.js"></script>
  <script language="javascript" type="text/javascript" src="jqPlot/jqplot.pointLabels.min.js"></script>
  <script id="example_1" type="text/javascript">    
     $(document).ready(function () {
         var line1 = [5600, 3150, 18];
         var ticks = ['Hardware <br /> and <br /> Installtion', 'Labor', 'Electricity'];    

         plot1 = $.jqplot('chart1', [line1], {
            title: 'Breakout total Cost of Ownership : LFD vs existing solution',
            animate: true,
            seriesColors: ['#1F497D', '#C0504D', '#9BBB59'],

            seriesDefaults: {
                renderer: $.jqplot.BarRenderer,
                rendererOptions: {
                    waterfall: true,
                    barWidth: 50,
                    animation:
                    {
                        speed: 2500
                    },
                    useNegativeColors: false,
                    varyBarColor: true
                },
                pointLabels: {
                    hideZeros: false
                },
                yaxis: 'yaxis',
                xaxis: 'x2axis',
                pointLabels: { show: true }
            },
            axes: {
                x2axis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks:ticks,
                    tickRenderer: $.jqplot.CanvasAxisTickRenderer,

                    tickOptions: {
                        fontFamily: 'Georgia',
                        fontSize: '8pt',
                        showGridline: true
                    }
                },
                yaxis: {
                    min: 0,
                    tickInterval: 20000,
                    tickOptions: {
                        formatString: "$%'d"
                    }
                }
            },
            cursor: {
                show: true
            }
        });
    });
 </script>

提前致谢

4

1 回答 1

3

删除下面的行后,它工作正常。谢谢

<script language="javascript" type="text/javascript" src="jqPlot/jqplot.canvasAxisTickRenderer.min.js"></script> 
于 2012-05-29T10:45:58.197 回答