本文整理汇总了Python中reportlab.graphics.charts.axes.XValueAxis类的典型用法代码示例。如果您正苦于以下问题:Python XValueAxis类的具体用法?Python XValueAxis怎么用?Python XValueAxis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XValueAxis类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sample5d
def sample5d():
"Sample drawing, xvalue/yvalue axes, y connected at left of x."
drawing = Drawing(400, 200)
data = [(10, 20, 30, 42)]
xAxis = XValueAxis()
xAxis.setPosition(50, 50, 300)
xAxis.configure(data)
yAxis = YValueAxis()
yAxis.setPosition(50, 50, 125)
yAxis.joinAxis = xAxis
yAxis.joinAxisMode = 'left'
yAxis.configure(data)
drawing.add(xAxis)
drawing.add(yAxis)
return drawing
示例2: __init__
def __init__(self):
PlotArea.__init__(self)
self.reversePlotOrder = 0
self.xValueAxis = XValueAxis()
self.yValueAxis = YValueAxis()
# this defines two series of 3 points. Just an example.
self.data = [((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)), ((1, 2), (2, 3), (2.5, 2), (3, 4), (4, 6))]
self.lines = TypedPropertyCollection(LinePlotProperties)
self.lines.strokeWidth = 1
self.lines[0].strokeColor = colors.red
self.lines[1].strokeColor = colors.blue
self.lineLabels = TypedPropertyCollection(Label)
self.lineLabelFormat = None
self.lineLabelArray = None
# this says whether the origin is inside or outside
# the bar - +10 means put the origin ten points
# above the tip of the bar if value > 0, or ten
# points inside if bar value < 0. This is different
# to label dx/dy which are not dependent on the
# sign of the data.
self.lineLabelNudge = 10
# if you have multiple series, by default they butt
# together.
# New line chart attributes.
self.joinedLines = 1 # Connect items with straight lines.
# private attributes
self._inFill = None
示例3: sample7b
def sample7b():
"Sample drawing, xvalue/ycat axes, y connected at left of x."
drawing = Drawing(400, 200)
data = [(10, 20, 30, 42)]
xAxis = XValueAxis()
xAxis._length = 300
xAxis.configure(data)
yAxis = YCategoryAxis()
yAxis.setPosition(50, 50, 125)
yAxis.joinAxis = xAxis
yAxis.joinAxisMode = 'left'
yAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
yAxis.labels.boxAnchor = 'e'
yAxis.configure(data)
drawing.add(xAxis)
drawing.add(yAxis)
return drawing
示例4: sample4c1
def sample4c1():
"xvalue/yvalue axes, without drawing axis lines/ticks."
drawing = Drawing(400, 200)
data = [(10, 20, 30, 42)]
yAxis = YValueAxis()
yAxis.setPosition(50, 50, 125)
yAxis.configure(data)
yAxis.visibleAxis = 0
yAxis.visibleTicks = 0
xAxis = XValueAxis()
xAxis._length = 300
xAxis.joinAxis = yAxis
xAxis.joinAxisMode = 'bottom'
xAxis.configure(data)
xAxis.visibleAxis = 0
xAxis.visibleTicks = 0
drawing.add(xAxis)
drawing.add(yAxis)
return drawing
示例5: sample4b
def sample4b():
"Sample drawing, xvalue/yvalue axes, y connected at value 35 of x."
drawing = Drawing(400, 200)
data = [(10, 20, 30, 42)]
yAxis = YValueAxis()
yAxis.setPosition(50, 50, 125)
yAxis.configure(data)
xAxis = XValueAxis()
xAxis._length = 300
xAxis.joinAxis = yAxis
xAxis.joinAxisMode = 'value'
xAxis.joinAxisPos = 35
xAxis.configure(data)
drawing.add(xAxis)
drawing.add(yAxis)
return drawing
示例6: LinePlot
class LinePlot(AbstractLineChart):
"""Line plot with multiple lines.
Both x- and y-axis are value axis (so there are no seperate
X and Y versions of this class).
"""
_attrMap = AttrMap(BASE=PlotArea,
reversePlotOrder = AttrMapValue(isBoolean, desc='If true reverse plot order.',advancedUsage=1),
lineLabelNudge = AttrMapValue(isNumber, desc='Distance between a data point and its label.',advancedUsage=1),
lineLabels = AttrMapValue(None, desc='Handle to the list of data point labels.'),
lineLabelFormat = AttrMapValue(None, desc='Formatting string or function used for data point labels.'),
lineLabelArray = AttrMapValue(None, desc='explicit array of line label values, must match size of data if present.'),
joinedLines = AttrMapValue(isNumber, desc='Display data points joined with lines if true.'),
strokeColor = AttrMapValue(isColorOrNone, desc='Color used for background border of plot area.'),
fillColor = AttrMapValue(isColorOrNone, desc='Color used for background interior of plot area.'),
lines = AttrMapValue(None, desc='Handle of the lines.'),
xValueAxis = AttrMapValue(None, desc='Handle of the x axis.'),
yValueAxis = AttrMapValue(None, desc='Handle of the y axis.'),
data = AttrMapValue(None, desc='Data to be plotted, list of (lists of) x/y tuples.'),
annotations = AttrMapValue(None, desc='list of callables, will be called with self, xscale, yscale.',advancedUsage=1),
behindAxes = AttrMapValue(isBoolean, desc='If true use separate line group.',advancedUsage=1),
gridFirst = AttrMapValue(isBoolean, desc='If true use draw grids before axes.',advancedUsage=1),
)
def __init__(self):
PlotArea.__init__(self)
self.reversePlotOrder = 0
self.xValueAxis = XValueAxis()
self.yValueAxis = YValueAxis()
# this defines two series of 3 points. Just an example.
self.data = [
((1,1), (2,2), (2.5,1), (3,3), (4,5)),
((1,2), (2,3), (2.5,2), (3,4), (4,6))
]
self.lines = TypedPropertyCollection(LinePlotProperties)
self.lines.strokeWidth = 1
self.lines[0].strokeColor = colors.red
self.lines[1].strokeColor = colors.blue
self.lineLabels = TypedPropertyCollection(Label)
self.lineLabelFormat = None
self.lineLabelArray = None
# this says whether the origin is inside or outside
# the bar - +10 means put the origin ten points
# above the tip of the bar if value > 0, or ten
# points inside if bar value < 0. This is different
# to label dx/dy which are not dependent on the
# sign of the data.
self.lineLabelNudge = 10
# if you have multiple series, by default they butt
# together.
# New line chart attributes.
self.joinedLines = 1 # Connect items with straight lines.
#private attributes
self._inFill = None
self.annotations = []
self.behindAxes = 0
self.gridFirst = 0
def demo(self):
"""Shows basic use of a line chart."""
drawing = Drawing(400, 200)
data = [
((1,1), (2,2), (2.5,1), (3,3), (4,5)),
((1,2), (2,3), (2.5,2), (3.5,5), (4,6))
]
lp = LinePlot()
lp.x = 50
lp.y = 50
lp.height = 125
lp.width = 300
lp.data = data
lp.joinedLines = 1
lp.lineLabelFormat = '%2.0f'
lp.strokeColor = colors.black
lp.lines[0].strokeColor = colors.red
lp.lines[0].symbol = makeMarker('FilledCircle')
lp.lines[1].strokeColor = colors.blue
lp.lines[1].symbol = makeMarker('FilledDiamond')
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueStep = 1
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueStep = 1
drawing.add(lp)
#.........这里部分代码省略.........
示例7: LinePlot
class LinePlot(PlotArea):
"""Line plot with multiple lines.
Both x- and y-axis are value axis (so there are no seperate
X and Y versions of this class).
"""
_attrMap = AttrMap(
BASE=PlotArea,
reversePlotOrder=AttrMapValue(isBoolean, desc="If true reverse plot order."),
lineLabelNudge=AttrMapValue(isNumber, desc="Distance between a data point and its label."),
lineLabels=AttrMapValue(None, desc="Handle to the list of data point labels."),
lineLabelFormat=AttrMapValue(None, desc="Formatting string or function used for data point labels."),
lineLabelArray=AttrMapValue(
None, desc="explicit array of line label values, must match size of data if present."
),
joinedLines=AttrMapValue(isNumber, desc="Display data points joined with lines if true."),
strokeColor=AttrMapValue(isColorOrNone, desc="Color used for background border of plot area."),
fillColor=AttrMapValue(isColorOrNone, desc="Color used for background interior of plot area."),
lines=AttrMapValue(None, desc="Handle of the lines."),
xValueAxis=AttrMapValue(None, desc="Handle of the x axis."),
yValueAxis=AttrMapValue(None, desc="Handle of the y axis."),
data=AttrMapValue(None, desc="Data to be plotted, list of (lists of) x/y tuples."),
annotations=AttrMapValue(None, desc="list of callables, will be called with self, xscale, yscale."),
)
def __init__(self):
PlotArea.__init__(self)
self.reversePlotOrder = 0
self.xValueAxis = XValueAxis()
self.yValueAxis = YValueAxis()
# this defines two series of 3 points. Just an example.
self.data = [((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)), ((1, 2), (2, 3), (2.5, 2), (3, 4), (4, 6))]
self.lines = TypedPropertyCollection(LinePlotProperties)
self.lines.strokeWidth = 1
self.lines[0].strokeColor = colors.red
self.lines[1].strokeColor = colors.blue
self.lineLabels = TypedPropertyCollection(Label)
self.lineLabelFormat = None
self.lineLabelArray = None
# this says whether the origin is inside or outside
# the bar - +10 means put the origin ten points
# above the tip of the bar if value > 0, or ten
# points inside if bar value < 0. This is different
# to label dx/dy which are not dependent on the
# sign of the data.
self.lineLabelNudge = 10
# if you have multiple series, by default they butt
# together.
# New line chart attributes.
self.joinedLines = 1 # Connect items with straight lines.
# private attributes
self._inFill = None
def demo(self):
"""Shows basic use of a line chart."""
drawing = Drawing(400, 200)
data = [((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)), ((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))]
lp = LinePlot()
lp.x = 50
lp.y = 50
lp.height = 125
lp.width = 300
lp.data = data
lp.joinedLines = 1
lp.lineLabelFormat = "%2.0f"
lp.strokeColor = colors.black
lp.lines[0].strokeColor = colors.red
lp.lines[0].symbol = makeMarker("FilledCircle")
lp.lines[1].strokeColor = colors.blue
lp.lines[1].symbol = makeMarker("FilledDiamond")
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueStep = 1
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueStep = 1
drawing.add(lp)
return drawing
def calcPositions(self):
"""Works out where they go.
Sets an attribute _positions which is a list of
#.........这里部分代码省略.........