I’m trying to do a Charts API implementation in xlwings – python, for basic chart manipulation like adding axis title, changing the line colors, plot marker size etc.
I get an error:
name ‘xlCategory’ is not defined
The code for implementation is
import xlwings as xw wb = xw.Book(r'Tau.xlsm') sht = wb.sheets.add(name ='Plot') tau_plot = sht.charts.add() tau_plot.chart_type='xy_scatter' tau_plot.set_source_data(sht.range('E1:F135')) tau_plot.api.Axes(xlCategory).HasTitle = True
Can you please help me with this error.
xlCategory is defined under XlAxisType, an enum that defines a number of constant values. If you’re not referencing the Excel type library / object model,
xlCategory means nothing to Python/xlwings. Use its underlying value instead (
1), or define your own copy so that the identifier
xlCategory is associated with the value
You can use Excel’s constants as follows:
>>> from xlwings.constants import AxisType >>> AxisType.xlCategory