[英]Change a Gantt chart in amCharts so that the column values are the axis values and the old axis values are the new column values?
I have a Gantt chart using amCharts v3 in PHP, and we would like to swap the column values with the X-axis values. 我有一个在PHP中使用amCharts v3的甘特图,我们希望将列值与X轴值交换。 For example, we have an incident Gantt chart which have X-axis values of the locations of incidents and the columns are the staff members of a school that were attached to that location, with how many incidents they were attached to. 例如,我们有一个事件甘特图,它具有事件发生位置的X轴值,列是该位置所附着的学校的工作人员,以及所附着的事件数目。
I have tried looking for the data that is pulled to create the chart and how they are used, but cannot see how to swap it around. 我曾尝试查找拉出的数据以创建图表以及如何使用它们,但无法看到如何交换数据。 Unfortunately I cannot display code as it is my company's and not mine. 不幸的是,我无法显示代码,因为这是我公司而不是我的。
First of all I would recommend to upgrade to amcharts4
, because it is much more flexible and has even new chart types. 首先,我建议升级到amcharts4
,因为它更加灵活,甚至具有新的图表类型。 You can migrate easily, beginning with just one chart. 您只需一张图表即可轻松迁移。 You can use amcharts3
and amcharts4
in parallel ( Migration Guide ). 您可以并行使用amcharts3
和amcharts4
( 迁移指南 )。
With amcharts4
it is possible to swap the xAxis
and the yAxis
. 使用amcharts4
可以交换xAxis
和yAxis
。
I used the gantt chart from the amcharts demos and updatet it in a code pen . 我使用了amcharts演示中的甘特图 ,并用代码笔对其进行了更新。
If you want to stay with amcharts3
it is also possible to swap xAxis
and yAxis
. 如果您想使用amcharts3
,也可以交换xAxis
和yAxis
。 You just have to invert the rotate
attribute in the config json: 你只需要翻转rotate
在配置的JSON属性:
var chart = AmCharts.makeChart( "chartdiv", {
"type": "gantt",
// your config ...
"rotate": false,
// more config ...
} );
I created another code pen with the full amcharts3
example adapted from the demo chart . 我创建了另一个代码笔 ,其中amcharts3
根据演示图改编的完整amcharts3
示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.