1
データを視覚化するために単純な円グラフを生成しようとしていますが、XlsxWriterでは同時に2つの列にデータを書き込むことはありません。他の例がうまく動作している場所。コードの下に見つけてください>[10.3, 4.17, 58.68, 24.42, 0.02, 0.0, 2.31, 0.12]
機能以下XlsxWriterは複数の列に同時に書き込みしません
へ -
{'core2': [10.3], 'core3': [4.17], 'core0': [58.68], 'core1': [24.42], 'core6': [0.02], 'core7': [0.0], 'core4': [2.31], 'core5': [0.12]})
実際のデータがリストとして渡されます。
私は私が間違って
行くに続いされる可能性がありますどこ無知だが、データであります:
def draw_simultaneously_busy_cores(type_of_chart,data,workbook):
print data
worksheet = workbook.add_worksheet()#'simultaneously_busy_cores')
bold = workbook.add_format({'bold': 1})
headings = [0, 1, 2, 3, 4, 5, 6, 7]
worksheet.write_column('$A$1', headings, bold)
worksheet.write_column('$B$1',headings)
chart1 = workbook.add_chart({'type': type_of_chart})
chart1.add_series({
'name': 'Simultaneous Busy Cores',
'categories': ['simultaneously_busy_cores', '=simultaneously_busy_cores!$A$1:$A$8'],
'values': ['simultaneously_busy_cores', '=simultaneously_busy_cores!$B$1:$B$8'],
#'data_labels': {'percentage': True, }
})
#Add a title.
chart1.set_title({'name': 'Simultaneous Busy Cores'})
#Set an Excel chart style. Colors with white outline and shadow.
chart1.set_style(10)
#Insert the chart into the worksheet (with an offset).
worksheet.insert_chart('C2', chart1, {'x_offset': 25, 'y_offset': 10})
私はリストと文字列の構文をどのように混ぜ合わせたのか分からない。何とかそれをキャッチすることができなかった、ありがとう! – R2D2