简体   繁体   English

使用自定义视图对列范围高图中的类别进行分组

[英]Group Categories in columnrange highcharts with custom view

I am using highcharts with angular 4.我正在使用角度为 4 的 highcharts。

I want to create a chart to show the result something like this:我想创建一个图表来显示这样的结果:

在此处输入图片说明

Where:在哪里:

  • GHRM and HR Scanner are application name. GHRM 和 HR Scanner 是应用程序名称。

  • We are showing some data groupwise (application wise here)我们正在按组显示一些数据(此处是应用明智的)

To achieve the above result I have tried using columnrange chart type in highcharts.为了实现上述结果,我尝试在 highcharts 中使用 columnrange 图表类型。

But the result of above link differs from my requirement.但上述链接的结果与我的要求不同。 As you can see the result of above link:正如你可以看到上面链接的结果:

在此处输入图片说明

Can any one help me to know how I can customize the categories view in this case to achieve the result as shown in first screen shot.任何人都可以帮助我了解在这种情况下如何自定义类别视图以实现如第一个屏幕截图所示的结果。

Getting that kind of look with grouped categories plugin would be a rather a hard task to accomplish.使用分组类别插件获得这种外观将是一项相当艰巨的任务。

Another approach is using a separate x axis for each set of categories (GHRM and HR Scanner in your case).另一种方法是为每组类别使用单独的 x 轴(在您的情况下为 GHRM 和 HR Scanner)。

Axes can be positioned via left & top properties and sized via height properties.轴可以通过left & top属性定位,并通过height属性调整大小。 These options are not documented yet but they work.这些选项尚未记录在案,但它们有效。 They accept relative values in percents (eg 30% ) and absolute values in pixels (eg 200px ).它们接受以百分比为单位的相对值(例如30% )和以像素为单位的绝对值(例如200px )。

  xAxis: [{
    categories: ['Category 1'],
    tickWidth: 0,
    height: '30%',
    offset: 0,
    title: {
      text: 'First x axis',
      rotation: 0,
      align: 'high'
    }
  }, {
    categories: ['Category 2', 'Category 3'],
    tickWidth: 0,
    height: '60%',
    top: '40%',
    offset: 0,
    title: {
      align: 'high',
      text: 'Second x axis',
      rotation: 0
    }
  }],

  plotOptions: {
    series: {
      grouping: false,
      groupPadding: 0,
      pointPadding: 0,
      borderWidth: 0
    }
  },

  series: [{
    data: [
      [1, 7]
    ],
  }, {
    data: [
      [2, 4],
      [3, 8]
    ],
    xAxis: 1
  }]

Live demo: http://jsfiddle.net/BlackLabel/s3k3s944/现场演示: http : //jsfiddle.net/BlackLabel/s3k3s944/

grouping has to be disabled so that columns are always centered.必须禁用grouping ,以便列始终居中。 pointPadding , groupPadding and borederWidth force columns to occupy maximum vertical range. pointPaddinggroupPaddingborederWidth强制列占据最大垂直范围。

All other options of axes configuration can be found in the Highcharts API : https://api.highcharts.com/highcharts/所有其他轴配置选项都可以在Highcharts API 中找到: https : //api.highcharts.com/highcharts/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM