![enter image description here](https://i.stack.imgur.com/BLxsl.png)
Мы реализовали функцию загрузки ppt с python -pptx, включая highcharts init. Но значения по оси X случайным образом перемешиваются. Даже полученные данные являются правильными.
Токовый выход по оси X: 29 февраля, 31 января, 31 декабря Требуемый выход по оси X: 31 октября, 30 ноября, 31 декабря c, .. и т. Д. (Данные являются динамическими c, мы не можем исправить значения осей)
def create_column_clustered_comparison_payload(slide_layout, input_chart_data, chart_width, chart_height, enable_3d):
column_clustered_comparison = { "infile": {
"title": {
"text": None
},
"chart": {},
"xAxis": {
"lineColor": "#000000",
"lineWidth": 1,
"tickLength": 0,
"gridLineWidth": 0,
"title": {
"text": None
},
"labels": {
"style": {
"fontSize": "9px",
"color": "#000000"
},
"padding": 0
}
},
"yAxis": [{
"title": {
"text": None
},
"lineColor": "#000000",
"lineWidth": 1,
"gridLineWidth": 0,
"labels": {
"style": {
"fontSize": "9px",
"color": "#000000"
},
"padding": 0,
"format": "{value}%"
}
}, {
"title": {
"text": None
},
"lineColor": "#000000",
"lineWidth": 1,
"opposite": True,
"gridLineWidth": 0,
"labels": {
"style": {
"fontSize": "9px",
"color": "#000000"
},
"padding": 0
}
}],
"plotOptions": {
"column": {
"grouping": True,
"shadow": False,
"dataLabels": {
"enabled": True,
"style": {
"fontSize": "10px",
"fontWeight": False
}
}
}
},
"legend": {
"enabled": True,
"itemStyle": {
"color": "#000000",
"fontSize": "9px",
"fontWeight": None
},
"itemMarginTop": 5,
"itemMarginBottom": 20
},
"credits": {
"enabled": False
},
"series": [{
"type": "column",
"borderWidth": 0,
"color": "#29336a"
}, {
"type": "column",
"borderWidth": 0,
"color": "#b8c4ff"
}, {
"type": "spline",
"color": "#ffab3d",
"lineWidth": 2,
"marker": {
"lineWidth": 2,
"lineColor": "#747578",
"fillColor": "white",
"radius": 2.5
}
}]
}
}
chart_keys = list(input_chart_data.keys())
categories = [category for category in input_chart_data[chart_keys[0]]['data'].keys()]
column_clustered_comparison['infile']['xAxis']['categories'] = categories
index = 0
for key in chart_keys:
chart_type = input_chart_data[key]['type']
if chart_type == 'bar':
index += 1
if index == 2:
column_clustered_comparison['infile']['series'][1]['name'] = key
column_clustered_comparison['infile']['series'][1]['data'] = \
[input_chart_data[key]['data'][category] for category in categories]
continue
column_clustered_comparison['infile']['series'][0]['name'] = key
column_clustered_comparison['infile']['series'][0]['data'] = \
[input_chart_data[key]['data'][category] for category in categories]
elif chart_type == 'line':
column_clustered_comparison['infile']['series'][2]['name'] = key
column_clustered_comparison['infile']['series'][2]['data'] = \
[input_chart_data[key]['data'][category] for category in categories]
column_clustered_comparison['infile']['series'][2]['yAxis'] = 1
if chart_width:
column_clustered_comparison['infile']['chart']['width'] = 570
if chart_height:
column_clustered_comparison['infile']['chart']['height'] = 280
return column_clustered_comparison