|
How to eliminate one chart's labels |
Posted by Kakao on Nov-05-2012 23:50 |
|
My chart has two charts in multi Chart. Both charts share the same X dates, I mean, the maximum and minimum dates are the same for both, although there are not coincident gaps in the data. I would like to have only one line of labels. How to tell one of the charts to not draw the labels? Or am I getting it wrong? The chart is attached and the code is Python:
[code]
chartX, chartY, plotX, plotY = 640, 300, 520, 220
c = pychartdir.XYChart(chartX, chartY, pychartdir.Transparent)
c.yAxis().setAutoScale(0.01, 0.01, 0.1)
c.yAxis().setColors(0x000000, 0xbb0000)
c.xAxis().setTickLength2(6,3)
#c.xAxis().setTickDensity(30)
c.xAxis().setLabelFormat('{value|mm-dd}')
#c.xAxis().setLabels2(day, '{value|mm-dd}')
#c.xAxis().setLabelStep(6, 3)
c.setNumberFormat(',')
setPlotAreaObj = c.setPlotArea(60, 35, plotX, plotY)
setPlotAreaObj.setGridColor(0xc0c0c0, 0xc0c0c0, -1, pychartdir.Transparent)
legend = c.addLegend(60, 10, 0, "vera.ttf", 10)
legend.setBackground(pychartdir.Transparent)
layer = c.addLineLayer()
layer.setXData(am_x)
dataSetObj = layer.addDataSet(am, 0xbb0000, am_title)
dataSetObj.setDataSymbol(pychartdir.CircleSymbol, 3, 0xdd0000, 0xdd0000)
layer.setLineWidth(1)
curve = pychartdir.ArrayMath(am)
curve.lowess2(am_x)
splineLayerObj = c.addSplineLayer(curve.result(), 0xff0000, "")
splineLayerObj.setXData(am_x)
splineLayerObj.setLineWidth(2)
labelStyleObj = c.xAxis().setLabelStyle("normal", 8)
labelStyleObj.setFontAngle(0)
labelStyleObj.setPos(0, 5)
trendLayerObj = c.addTrendLayer(am, c.dashLineColor(0xbb0000, pychartdir.DashLine), "")
trendLayerObj.setLineWidth(2)
trendLayerObj.setXData(am_x)
c2 = pychartdir.XYChart(chartX, chartY, pychartdir.Transparent)
c2.setPlotArea(60, 35, plotX, plotY, pychartdir.Transparent, -1, pychartdir.Transparent, pychartdir.Transparent, pychartdir.Transparent)
c2.setNumberFormat(',')
c2.yAxis().setAutoScale(0.01, 0.01, 0.1)
c2.yAxis().setColors(0x000000, 0x004400)
c2.setYAxisOnRight()
c2.xAxis().setLabelFormat('{value|mm/dd}')
legend = c2.addLegend(420, 10, 0, "normal", 10)
legend.setBackground(pychartdir.Transparent)
layer = c2.addLineLayer()
layer.setXData(nm_x)
dataSetObj = layer.addDataSet(nm, 0x004400, nm_title)
dataSetObj.setDataSymbol(pychartdir.CircleSymbol, 3, 0x00bb00, 0x00bb00)
layer.setLineWidth(1)
m = pychartdir.MultiChart(chartX, chartY, 0xfafafa)
m.addChart(0, 0, c2)
m.addChart(0, 0, c)
title = m.addTitle("Team size History", "normal", 13)
[/code]
|
Re: How to eliminate one chart's labels |
Posted by Peter Kwan on Nov-06-2012 02:12 |
|
Hi Kakao,
To hide the x-axis labels, simply set them to transparent.
c2.xAxis().setLabelStyle("arial.ttf", 8, pychartdir.Transparent)
For your chart, actually, you can put everything in the same chart, instead of using two separate charts. It is like:
chartX, chartY, plotX, plotY = 640, 300, 520, 220
c = pychartdir.XYChart(chartX, chartY, pychartdir.Transparent)
c.yAxis().setAutoScale(0.01, 0.01, 0.1)
c.yAxis().setColors(0x000000, 0xbb0000)
c.xAxis().setTickLength2(6,3)
#c.xAxis().setTickDensity(30)
c.xAxis().setLabelFormat('{value|mm-dd}')
#c.xAxis().setLabels2(day, '{value|mm-dd}')
#c.xAxis().setLabelStep(6, 3)
c.setNumberFormat(',')
setPlotAreaObj = c.setPlotArea(60, 35, plotX, plotY)
setPlotAreaObj.setGridColor(0xc0c0c0, 0xc0c0c0, -1, pychartdir.Transparent)
legend = c.addLegend(60 + plotY / 2, 10, 0, "vera.ttf", 10)
legend.setBackground(pychartdir.Transparent)
legend.setAlignment(pychartdir.TopCenter)
layer = c.addLineLayer()
layer.setXData(am_x)
dataSetObj = layer.addDataSet(am, 0xbb0000, am_title)
dataSetObj.setDataSymbol(pychartdir.CircleSymbol, 3, 0xdd0000, 0xdd0000)
layer.setLineWidth(1)
curve = pychartdir.ArrayMath(am)
curve.lowess2(am_x)
splineLayerObj = c.addSplineLayer(curve.result(), 0xff0000, "")
splineLayerObj.setXData(am_x)
splineLayerObj.setLineWidth(2)
labelStyleObj = c.xAxis().setLabelStyle("normal", 8)
labelStyleObj.setFontAngle(0)
labelStyleObj.setPos(0, 5)
trendLayerObj = c.addTrendLayer(am, c.dashLineColor(0xbb0000, pychartdir.DashLine), "")
trendLayerObj.setLineWidth(2)
trendLayerObj.setXData(am_x)
c.yAxis2().setAutoScale(0.01, 0.01, 0.1)
c.yAxis2().setColors(0x000000, 0x004400)
layer = c.addLineLayer()
layer.setUseYAxis2()
layer.setXData(nm_x)
dataSetObj = layer.addDataSet(nm, 0x004400, nm_title)
dataSetObj.setDataSymbol(pychartdir.CircleSymbol, 3, 0x00bb00, 0x00bb00)
layer.setLineWidth(1)
c.addTitle("Team size History", "normal", 13)
Hope this can help.
Regards
Peter Kwan |
Re: How to eliminate one chart's labels |
Posted by Kakao on Nov-06-2012 20:31 |
|
Hello Peter.
That was better than what I asked for. The only one chart solution is definitely superior. Thank you very much. |
|