【问题标题】:Highcharts multiple x-Axis without multiple series?Highcharts多个x轴没有多个系列?
【发布时间】:2013-12-06 18:13:47
【问题描述】:

这个小提琴使用多个系列并为每个系列显示一个轴。是否可以使用单个系列制作多个轴? http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/combo-multi-axes/

xAxis:[{
        categories:setup.x_mixed,
        maxZoom:5,
        minPadding: 0.2,
        labels:{
          "enabled":setup.categories_label,
          "y":1,
          "style":{
            "fontSize":13,
            "color":"#999",
            fontFamily:"'helvetica neue',helvetica",
            whiteSpace:"nowrap",
            textOverflow:"clip",
            width:"100%",
            marginTop:legendSpacing
          },
          formatter:function () {
            return this.value.split("|")[0]
          }
        },
        lineColor:"rgba(255,255,255,0)",
        tickWidth:0,
        offset:0
      }, { // Secondary yAxis
        categories:setup.x_mixed,
        maxZoom:5,
        minPadding: 0.2,
        labels:{
          "enabled":setup.categories_label,
          "y":16,
          "style":{
            "fontSize":13,
            "color":"#999",
            fontFamily:"'helvetica neue',helvetica",
            whiteSpace:"nowrap",
            textOverflow:"clip",
            width:"100%",
            marginTop:legendSpacing
          },
          formatter:function () {
            return this.value.split("|")[1]
          }
        },
        lineColor:"rgba(255,255,255,0)",
        tickWidth:0,
        offset:0

        }],

【问题讨论】:

    标签: javascript highcharts axes multiple-axes


    【解决方案1】:

    你也可以在额外的轴上使用linkedTo参数http://api.highcharts.com/highcharts#yAxis.linkedTo

    【讨论】:

      【解决方案2】:

      其实很简单,

      声明 2 xAxis 与您在示例中提到的 yAxis 相同,其中一个为 opposite:true

      由于您只有一个系列,因此使用 getExtremes() 和 setExtremes() 将第二个轴的极值设置为与第一个轴的极值相同,如此处http://jsfiddle.net/W43Zb/ 中的小提琴所示

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-12-22
        • 2013-05-25
        • 2013-10-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多