[reportlab-users] setting line color in LineChart
Dinu Gherman
reportlab-users@reportlab.com
Fri, 05 Jul 2002 09:56:06 +0200 (CEST)
Alexandre <Alexandre.Fayolle@logilab.fr>:
> lc.lines[O].strokeColor.color = colors.pink
> lc.lines[1].strokeColor.color = colors.cornsilk
> lc.lines[2].strokeColor.color = colors.orange
Have you tried this?
lc.lines[O].strokeColor = colors.pink
lc.lines[1].strokeColor = colors.cornsilk
lc.lines[2].strokeColor = colors.orange
> Trying to set lc.lines[i].color raises an exception, and
> I could not find anything in the various manuals.
Try this to play a bit:
>>> from reportlab.graphics.charts.linecharts import HorizontalLineChart
>>>
>>> dir(HorizontalLineChart)
['__doc__', '__init__', '__module__', '__setattr__', '_attrMap',
'calcPositions', 'demo', 'draw', 'drawLabel', 'dumpProperties', 'getProperties',
'makeBackground', 'makeLines', 'provideNode', 'setProperties', 'verify']
>>>
>>> hlc = HorizontalLineChart()
>>>
>>> hlc.lines.dumpProperties()
[0].strokeColor = Color(1,0,0)
[1].strokeColor = Color(0,.501961,0)
[2].strokeColor = Color(0,0,1)
strokeWidth = 1
>>>
or even:
>>> hlc.dumpProperties()
categoryAxis.categoryNames = None
categoryAxis.gridEnd = 0
categoryAxis.gridStart = 0
categoryAxis.gridStrokeColor = Color(0,0,0)
categoryAxis.gridStrokeDashArray = None
categoryAxis.gridStrokeWidth = 0.25
categoryAxis.joinAxis = None
categoryAxis.joinAxisMode = None
categoryAxis.joinAxisPos = None
categoryAxis.labelAxisMode = axis
categoryAxis.labels = <reportlab.graphics.widgetbase.TypedPropertyCollection
instance at 0x4020b0>
categoryAxis.reverseDirection = 0
categoryAxis.strokeColor = Color(0,0,0)
categoryAxis.strokeDashArray = None
categoryAxis.strokeWidth = 1
categoryAxis.style = parallel
categoryAxis.tickDown = 5
categoryAxis.tickUp = 0
categoryAxis.visible = 1
categoryAxis.visibleAxis = 1
categoryAxis.visibleGrid = 0
categoryAxis.visibleTicks = 1
categoryNames = ('North', 'South', 'East', 'West')
data = [(100, 110, 120, 130), (70, 80, 80, 90)]
fillColor = None
groupSpacing = 1
height = 100
joinedLines = 1
lineLabelFormat = None
lineLabelNudge = 10
lineLabels = <reportlab.graphics.widgetbase.TypedPropertyCollection instance at
0x3fd790>
lines = <reportlab.graphics.widgetbase.TypedPropertyCollection instance at 0x3ff7c0>
strokeColor = None
useAbsolute = 0
valueAxis.avoidBoundFrac = None
valueAxis.forceZero = 0
valueAxis.gridEnd = 0
valueAxis.gridStart = 0
valueAxis.gridStrokeColor = Color(0,0,0)
valueAxis.gridStrokeDashArray = None
valueAxis.gridStrokeWidth = 0.25
valueAxis.joinAxis = None
valueAxis.joinAxisMode = None
valueAxis.joinAxisPos = None
valueAxis.labelTextFormat = %d
valueAxis.labels = <reportlab.graphics.widgetbase.TypedPropertyCollection
instance at 0x3f9d60>
valueAxis.maximumTicks = 7
valueAxis.minimumTickSpacing = 10
valueAxis.rangeRound = none
valueAxis.strokeColor = Color(0,0,0)
valueAxis.strokeDashArray = None
valueAxis.strokeWidth = 1
valueAxis.tickLeft = 5
valueAxis.tickRight = 0
valueAxis.valueMax = None
valueAxis.valueMin = None
valueAxis.valueStep = None
valueAxis.visible = 1
valueAxis.visibleAxis = 1
valueAxis.visibleGrid = 0
valueAxis.visibleTicks = 1
width = 200
x = 0
y = 0
>>>
Regards,
Dinu