def create_multi_xychart(title, labels, series_list, series_top, maxv=100): # labels = [labels[0]] series_list = [series_list[0]] # Create a XYChart object of size 540 x 375 pixels c = XYChart(900, 320) # Add a title to the chart using 18 pts Times Bold Italic font #c.addTitle("Average Weekly Network Load", "timesbi.ttf", 18) title = c.addTitle(utils.to_utf8(title), "simsun.ttc", 12) title.setMargin2(20, 0, 5, 30) color_list = BASE_COLOR # Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical # gradient color from light red (ffdddd) to dark red (880000) as background. Set # border and grid lines to white (ffffff). chart_width = 30 + 190 * len(labels) c.setPlotArea(50, 90, chart_width, 200, c.linearGradientColor(60, 40, 60, 280, 0xffffff, 0xd8e2ec), -1, 0xffffff, 0xffffff) legendBox = c.addLegend(50, 16, 0, "simsun.ttc", 10) legendBox.setBackground(Transparent) #legendBox.setAlignment(TopCenter) legendBox.setHeight(30) # Set the x axis labels c.xAxis().setLabels([utils.to_utf8(label) for label in labels]) # Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5) # Set axis label style to 8pts Arial Bold c.xAxis().setLabelStyle("simsun.ttc", 9) c.yAxis().setLabelStyle("simsun.ttc", 9) # Set axis line width to 2 pixels c.xAxis().setWidth(2) c.yAxis().setWidth(2) c.yAxis2().setWidth(1) # Add axis title c.yAxis().setTitle("得分/Score", "simsun.ttc", 9) c.yAxis().setLinearScale(0, maxv) # Add a multi-bar layer with 3 data sets and 4 pixels 3D depth #~ layer = c.addBarLayer2(Side, 1) layer = c.addBarLayer() layer.setBarGap(0.2) layer.setBarWidth(150, 48) for index, series in enumerate(series_list): layer.addDataSet(series['value'], color_list[index % len(color_list)], utils.to_utf8(series['name'])) if series_top: legendBox.addKey2(2, utils.to_utf8(series_top['name']), 0xFF6900, 2) markLayer = c.addBoxWhiskerLayer(None, None, None, None, series_top['value'], -1, 0xFF6900) markLayer.setLineWidth(2) markLayer.setDataGap(0.1) markLayer.setDataLabelStyle("simsun.ttc", 9) markLayer.setDataLabelFormat("{value|1}") # Set bar border to transparent. Use soft lighting effect with light direction from # top. layer.setBorderColor(Transparent, softLighting(Top)) #layer.setBorderColor(Transparent, barLighting(0.75, 2.0)) layer.setAggregateLabelFormat("{value|1}") # output the chart return c.makeChart2(PNG)
def create_simple_xychart(title, labels, data): # The colors for the bars colors = BASE_COLOR # Create a PieChart object of size 600 x 380 pixels. c = XYChart(380, 50 + 30 * len(labels)) # Use the white on black palette, which means the default text and line colors are # white #~ c.setColors(whiteOnBlackPalette) # Use a vertical gradient color from blue (0000cc) to deep blue (000044) as # background. Use rounded corners of 30 pixels radius for the top-left and # bottom-right corners. c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight(), '0xEFF1F1', '0xDEE3E4') ) #~ c.setRoundedFrame('0xffffff', 30, 0, 30, 0) # Add a title using 18 pts Times New Roman Bold Italic font. Add 6 pixels top and # bottom margins to the title. #title = c.addTitle(title, "simsun.ttc", 12) #title.setMargin2(0, 0, 6, 0) #title_height = 25 title_height = 0 # Add a separator line in white color just under the title #~ c.addLine(20, title.getHeight(), c.getWidth() - 21, title.getHeight(), '0xffffff') c.addLine(20, title_height, c.getWidth() - 21, title_height, '0xffffff') # Tentatively set the plotarea at (70, 80) and of 480 x 240 pixels in size. Use # transparent border and white grid lines c.setPlotArea(70, 70, 360, 30 + 30 * len(labels), -1, -1, Transparent, '0xffffff') # Swap the axis so that the bars are drawn horizontally c.swapXY() # Add a multi-color bar chart layer using the supplied data. Use bar gradient # lighting with the light intensity from 0.75 to 2.0 layer = c.addBarLayer3(data, colors) #layer.setBorderColor(Transparent, barLighting(0.75, 2.0)) layer.setBorderColor(Transparent, softLighting(Right)) # Set the aggregate label format layer.setAggregateLabelFormat("{value|1}") # Set the aggregate label font to 8 point Arial Bold Italic layer.setAggregateLabelStyle("simsun.ttc", 8) # Set the labels on the x axis. c.xAxis().setLabels(labels) # Show the same scale on the left and right y-axes #c.syncYAxis() # Set the bottom y-axis title using 10pt Arial Bold font c.yAxis().setTitle("总得分 Total Score", "simsun.ttc", 9) # Set y-axes to transparent c.yAxis().setColors(Transparent) c.yAxis2().setColors(Transparent) # Disable ticks on the x-axis by setting the tick color to transparent c.xAxis().setTickColor(Transparent) # Set the label styles of all axes to 8pt Arial Bold font c.xAxis().setLabelStyle("simsun.ttc", 9) c.yAxis().setLabelStyle("simsun.ttc", 9) c.yAxis2().setLabelStyle("simsun.ttc", 9) c.yAxis().setLinearScale(0, 100) # Adjust the plot area size, such that the bounding box (inclusive of axes) is 30 # pixels from the left edge, 25 pixels below the title, 50 pixels from the right # edge, and 25 pixels from the bottom edge. c.packPlotArea(20, title_height + 15, c.getWidth() - 30, c.getHeight() - 15) # Output the chart return c.makeChart2(PNG)
def create_history_now_future_xychart(title, labels, series_list, series_top, maxv=100): top3, ytd, ave, future_score, point = get_ave_score(series_list) series_list.append(dict(name=u'2012 Top3 Ave', value=top3)) series_list.append(dict(name=u'2012 YTD', value=ytd)) series_list.append(dict(name=u'2011 Ave', value=ave)) # Create a XYChart object of size 540 x 375 pixels c = XYChart(900, 320) # Add a title to the chart using 18 pts Times Bold Italic font #c.addTitle("Average Weekly Network Load", "timesbi.ttf", 18) title = c.addTitle(utils.to_utf8(title), "simsun.ttc", 12) title.setMargin2(20, 0, 10, 30) color_list = BASE_COLOR COLOR_BLUE = 0x0070C0 COLOR_93 = 0x00B050 COLOR_87 = 0xFFD600 COLOR_TOP3_AVE = 0x595443 COLOR_YTD = 0xFF0000 COLOR_AVE = 0x5678A9 # Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical # gradient color from light red (ffdddd) to dark red (880000) as background. Set # border and grid lines to white (ffffff). chart_width = 30 + 190 * len(labels) c.setPlotArea(50, 90, chart_width, 200, c.linearGradientColor(60, 40, 60, 280, 0xffffff, 0xd8e2ec), -1, 0xffffff, 0xffffff) legendBox = c.addLegend(50, 30, 0, "simsun.ttc", 10) legendBox.setBackground(Transparent) #legendBox.setAlignment(TopCenter) legendBox.setHeight(30) # Set the x axis labels c.xAxis().setLabels([utils.to_utf8(label) for label in labels]) # Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5) # Set axis label style to 8pts Arial Bold c.xAxis().setLabelStyle("simsun.ttc", 9) c.yAxis().setLabelStyle("simsun.ttc", 9) # Set axis line width to 2 pixels c.xAxis().setWidth(2) c.yAxis().setWidth(2) c.yAxis2().setWidth(1) # Add axis title c.yAxis().setTitle("得分/Score", "simsun.ttc", 9) c.yAxis().setLinearScale(0, maxv) # Add a multi-bar layer with 3 data sets and 4 pixels 3D depth #~ layer = c.addBarLayer2(Side, 1) layer = c.addBarLayer() layer.setBarGap(0.1) layer.setBarWidth(170, 18) for index, series in enumerate(series_list): values = series['value'] if len(values) > 1: color = COLOR_BLUE else: values.append(future_score) if point == 93: color = COLOR_93 elif point == 87: color = COLOR_87 else: color = COLOR_BLUE name = utils.to_utf8(series['name']) if name == u'2012 Top3 Ave': color = COLOR_TOP3_AVE if name == u'2012 YTD': color = COLOR_YTD if name == u'2011 Ave': color = COLOR_AVE #print values, color, name write_list = [] for value in values: if value == -1 or value > 100: write_list.append(0) else: write_list.append(value) layer.addDataSet(write_list, color, name) for i, v in enumerate(values): if v == -1 or v > 100: if name in (u'2012 Top3 Ave',u'2012 YTD', u'2011 Ave'): layer.addCustomGroupLabel(index, i, " ") else: layer.addCustomGroupLabel(index, i, "N/A") else: layer.setAggregateLabelFormat("{value|1}") layer.setAggregateLabelStyle ('', 10, '0x0000', 0) yMark = c.yAxis().addMark(point, '0x800080', '%s' % point) yMark.setLineWidth(1) yMark.setAlignment(TopCenter) # Set bar border to transparent. Use soft lighting effect with light direction from # top. layer.setBorderColor(Transparent, softLighting(Top)) #layer.setBorderColor(Transparent, barLighting(0.75, 2.0)) #layer.setAggregateLabelFormat("{value|1}") # output the chart return c.makeChart2(PNG)
def DoRewardChart_Thread(self, rewardID, size, icon): """This function is generating the reward graph for the incursion journal The image is build opon data from the reward system, which is cached with the policy never, None, None""" reward = self.GetRewardData(rewardID) maxRewardValue = 0 minPlayerCount = 0 maxPlayerCount = 0 allSecurityBandTable = None lowSecurityBandTable = None highSecurityBandTable = None for rewardCriteria, rewardTables in reward.immediateRewards.iteritems( ): if not rewardTables: continue if rewardCriteria == const.rewardCriteriaAllSecurityBands: maxRewardValue = self.GetMaxRewardValue( rewardTables, const.rewardTypeISK) minPlayerCount = self.GetMinRewardPlayerCount(rewardTables) maxPlayerCount = self.GetMaxRewardPlayerCount(rewardTables) allSecurityBandTable = rewardTables[0] break if rewardCriteria == const.rewardCriteriaHighSecurity: highSecurityBandTable = rewardTables[0] elif rewardCriteria == const.rewardCriteriaLowSecurity: lowSecurityBandTable = rewardTables[0] else: continue maxRewardValue = max( maxRewardValue, self.GetMaxRewardValue(rewardTables, const.rewardTypeISK)) minPlayerCount = min(minPlayerCount, self.GetMinRewardPlayerCount(rewardTables)) maxPlayerCount = max(maxPlayerCount, self.GetMaxRewardPlayerCount(rewardTables)) scale = 1.0 / maxRewardValue majorTick = (maxPlayerCount - minPlayerCount) / 4 data = [] labels = [] for x in xrange(minPlayerCount, maxPlayerCount + 1): if allSecurityBandTable is not None: quantity = self.GetQuantityForCount(allSecurityBandTable, x) * scale data.append(quantity) else: quantityHigh = self.GetQuantityForCount( highSecurityBandTable, x) * scale quantityLow = self.GetQuantityForCount(lowSecurityBandTable, x) * scale data.append((quantityHigh, quantityLow)) labels.append(str(x)) chart = XYChart(size, size, BLACK, GRAY, False) chart.setPlotArea(PLOT_OFFSET, PLOT_OFFSET, size - PLOT_OFFSET - PLOT_RIGHT_MARGIN, size - PLOT_OFFSET - PLOT_BOTTOM_MARGIN, DARKGRAY, -1, -1, GRAY, Transparent) if localization.util.GetLanguageID( ) == localization.const.LOCALE_SHORT_ENGLISH: font = 'arial.ttf' titleFont = 'arialbd.ttf' else: font = titleFont = uicore.font.GetFontDefault() chart.addLegend(LEGEND_OFFSET, LEGEND_OFFSET, 0, font, 8).setBackground(Transparent) legend = chart.getLegend() legend.setFontColor(WHITE) chart.addTitle(localization.GetByLabel('UI/Incursion/Reward/Title'), titleFont, 12, WHITE).setBackground(Transparent) yAxis = chart.yAxis() yAxis.setTitle( localization.GetByLabel('UI/Incursion/Reward/PayoutMultiplier'), font, 10, WHITE) yAxis.setColors(GRAY, WHITE) yAxis.setLinearScale(0, 1.02, 0.5, 0.25) xAxis = chart.xAxis() xAxis.setLabels(labels) xAxis.setLabelStep(majorTick) xAxis.setColors(GRAY, WHITE) xAxis.setTitle( localization.GetByLabel('UI/Incursion/Reward/NumberPilots'), font, 9, WHITE) layer = chart.addLineLayer2() layer.setLineWidth(1) if allSecurityBandTable is not None: layer.addDataSet(data, COLOR_HIGH_SEC, localization.GetByLabel('UI/Common/Ratio')) else: dataHigh, dataLow = zip(*data) layer.addDataSet(dataHigh, COLOR_HIGH_SEC, localization.GetByLabel('UI/Common/HighSec')) layer.addDataSet(dataLow, COLOR_NULL_SEC, localization.GetByLabel('UI/Common/LowNullSec')) directory = os.path.normpath( os.path.join(blue.paths.ResolvePath(u'cache:/'), 'Pictures', 'Rewards')) if not os.path.exists(directory): os.makedirs(directory) pictureName = 'rewardchart2_%s_%d_%d.png' % (session.languageID, size, rewardID) resPath = u'cache:/Pictures/Rewards/' + pictureName path = os.path.join(directory, pictureName) imageBuffer = chart.makeChart2(PNG) f = open(path, 'wb') f.write(imageBuffer) f.close() icon.LoadTexture(resPath) icon.SetRect(0, 0, size, size)
def DoRewardChart_Thread(self, rewardID, size, icon): reward = self.GetRewardData(rewardID) maxRewardValue = 0 minPlayerCount = 0 maxPlayerCount = 0 allSecurityBandTable = None lowSecurityBandTable = None highSecurityBandTable = None for rewardCriteria, rewardTables in reward.immediateRewards.iteritems(): if not rewardTables: continue if rewardCriteria == const.rewardCriteriaAllSecurityBands: maxRewardValue = self.GetMaxRewardValue(rewardTables, const.rewardTypeISK) minPlayerCount = self.GetMinRewardPlayerCount(rewardTables) maxPlayerCount = self.GetMaxRewardPlayerCount(rewardTables) allSecurityBandTable = rewardTables[0] break if rewardCriteria == const.rewardCriteriaHighSecurity: highSecurityBandTable = rewardTables[0] elif rewardCriteria == const.rewardCriteriaLowSecurity: lowSecurityBandTable = rewardTables[0] else: continue maxRewardValue = max(maxRewardValue, self.GetMaxRewardValue(rewardTables, const.rewardTypeISK)) minPlayerCount = min(minPlayerCount, self.GetMinRewardPlayerCount(rewardTables)) maxPlayerCount = max(maxPlayerCount, self.GetMaxRewardPlayerCount(rewardTables)) scale = 1.0 / maxRewardValue majorTick = (maxPlayerCount - minPlayerCount) / 4 data = [] labels = [] for x in xrange(minPlayerCount, maxPlayerCount + 1): if allSecurityBandTable is not None: quantity = self.GetQuantityForCount(allSecurityBandTable, x) * scale data.append(quantity) else: quantityHigh = self.GetQuantityForCount(highSecurityBandTable, x) * scale quantityLow = self.GetQuantityForCount(lowSecurityBandTable, x) * scale data.append((quantityHigh, quantityLow)) labels.append(str(x)) chart = XYChart(size, size, BLACK, GRAY, False) chart.setPlotArea(PLOT_OFFSET, PLOT_OFFSET, size - PLOT_OFFSET - PLOT_RIGHT_MARGIN, size - PLOT_OFFSET - PLOT_BOTTOM_MARGIN, DARKGRAY, -1, -1, GRAY, Transparent) if localizationUtil.GetLanguageID() == localization.LOCALE_SHORT_ENGLISH: font = 'arial.ttf' titleFont = 'arialbd.ttf' else: font = titleFont = sm.GetService('font').GetFontDefault() chart.addLegend(LEGEND_OFFSET, LEGEND_OFFSET, 0, font, 8).setBackground(Transparent) legend = chart.getLegend() legend.setFontColor(WHITE) chart.addTitle(localization.GetByLabel('UI/Incursion/Reward/Title'), titleFont, 12, WHITE).setBackground(Transparent) yAxis = chart.yAxis() yAxis.setTitle(localization.GetByLabel('UI/Incursion/Reward/PayoutMultiplier'), font, 10, WHITE) yAxis.setColors(GRAY, WHITE) yAxis.setLinearScale(0, 1.02, 0.5, 0.25) xAxis = chart.xAxis() xAxis.setLabels(labels) xAxis.setLabelStep(majorTick) xAxis.setColors(GRAY, WHITE) xAxis.setTitle(localization.GetByLabel('UI/Incursion/Reward/NumberPilots'), font, 9, WHITE) layer = chart.addLineLayer2() layer.setLineWidth(1) if allSecurityBandTable is not None: layer.addDataSet(data, COLOR_HIGH_SEC, localization.GetByLabel('UI/Common/Ratio')) else: dataHigh, dataLow = zip(*data) layer.addDataSet(dataHigh, COLOR_HIGH_SEC, localization.GetByLabel('UI/Common/HighSec')) layer.addDataSet(dataLow, COLOR_NULL_SEC, localization.GetByLabel('UI/Common/LowNullSec')) directory = os.path.normpath(os.path.join(blue.paths.ResolvePath(u'cache:/'), 'Pictures', 'Rewards')) if not os.path.exists(directory): os.makedirs(directory) pictureName = 'rewardchart2_%s_%d_%d.png' % (session.languageID, size, rewardID) resPath = u'cache:/Pictures/Rewards/' + pictureName path = os.path.join(directory, pictureName) imageBuffer = chart.makeChart2(PNG) f = open(path, 'wb') f.write(imageBuffer) f.close() icon.LoadTexture(resPath) icon.SetRect(0, 0, size, size)
def create_simple_xychart(title, labels, data): # The colors for the bars colors = BASE_COLOR # Create a PieChart object of size 600 x 380 pixels. c = XYChart(380, 50 + 30 * len(labels)) # Use the white on black palette, which means the default text and line colors are # white #~ c.setColors(whiteOnBlackPalette) # Use a vertical gradient color from blue (0000cc) to deep blue (000044) as # background. Use rounded corners of 30 pixels radius for the top-left and # bottom-right corners. c.setBackground( c.linearGradientColor(0, 0, 0, c.getHeight(), '0xEFF1F1', '0xDEE3E4')) #~ c.setRoundedFrame('0xffffff', 30, 0, 30, 0) # Add a title using 18 pts Times New Roman Bold Italic font. Add 6 pixels top and # bottom margins to the title. #title = c.addTitle(title, "simsun.ttc", 12) #title.setMargin2(0, 0, 6, 0) #title_height = 25 title_height = 0 # Add a separator line in white color just under the title #~ c.addLine(20, title.getHeight(), c.getWidth() - 21, title.getHeight(), '0xffffff') c.addLine(20, title_height, c.getWidth() - 21, title_height, '0xffffff') # Tentatively set the plotarea at (70, 80) and of 480 x 240 pixels in size. Use # transparent border and white grid lines c.setPlotArea(70, 70, 360, 30 + 30 * len(labels), -1, -1, Transparent, '0xffffff') # Swap the axis so that the bars are drawn horizontally c.swapXY() # Add a multi-color bar chart layer using the supplied data. Use bar gradient # lighting with the light intensity from 0.75 to 2.0 layer = c.addBarLayer3(data, colors) #layer.setBorderColor(Transparent, barLighting(0.75, 2.0)) layer.setBorderColor(Transparent, softLighting(Right)) # Set the aggregate label format layer.setAggregateLabelFormat("{value|1}") # Set the aggregate label font to 8 point Arial Bold Italic layer.setAggregateLabelStyle("simsun.ttc", 8) # Set the labels on the x axis. c.xAxis().setLabels(labels) # Show the same scale on the left and right y-axes #c.syncYAxis() # Set the bottom y-axis title using 10pt Arial Bold font c.yAxis().setTitle("总得分 Total Score", "simsun.ttc", 9) # Set y-axes to transparent c.yAxis().setColors(Transparent) c.yAxis2().setColors(Transparent) # Disable ticks on the x-axis by setting the tick color to transparent c.xAxis().setTickColor(Transparent) # Set the label styles of all axes to 8pt Arial Bold font c.xAxis().setLabelStyle("simsun.ttc", 9) c.yAxis().setLabelStyle("simsun.ttc", 9) c.yAxis2().setLabelStyle("simsun.ttc", 9) c.yAxis().setLinearScale(0, 100) # Adjust the plot area size, such that the bounding box (inclusive of axes) is 30 # pixels from the left edge, 25 pixels below the title, 50 pixels from the right # edge, and 25 pixels from the bottom edge. c.packPlotArea(20, title_height + 15, c.getWidth() - 30, c.getHeight() - 15) # Output the chart return c.makeChart2(PNG)
def create_history_now_future_xychart(title, labels, series_list, series_top, maxv=100): top3, ytd, ave, future_score, point = get_ave_score(series_list) series_list.append(dict(name=u'2012 Top3 Ave', value=top3)) series_list.append(dict(name=u'2012 YTD', value=ytd)) series_list.append(dict(name=u'2011 Ave', value=ave)) # Create a XYChart object of size 540 x 375 pixels c = XYChart(900, 320) # Add a title to the chart using 18 pts Times Bold Italic font #c.addTitle("Average Weekly Network Load", "timesbi.ttf", 18) title = c.addTitle(utils.to_utf8(title), "simsun.ttc", 12) title.setMargin2(20, 0, 10, 30) color_list = BASE_COLOR COLOR_BLUE = 0x0070C0 COLOR_93 = 0x00B050 COLOR_87 = 0xFFD600 COLOR_TOP3_AVE = 0x595443 COLOR_YTD = 0xFF0000 COLOR_AVE = 0x5678A9 # Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical # gradient color from light red (ffdddd) to dark red (880000) as background. Set # border and grid lines to white (ffffff). chart_width = 30 + 190 * len(labels) c.setPlotArea(50, 90, chart_width, 200, c.linearGradientColor(60, 40, 60, 280, 0xffffff, 0xd8e2ec), -1, 0xffffff, 0xffffff) legendBox = c.addLegend(50, 30, 0, "simsun.ttc", 10) legendBox.setBackground(Transparent) #legendBox.setAlignment(TopCenter) legendBox.setHeight(30) # Set the x axis labels c.xAxis().setLabels([utils.to_utf8(label) for label in labels]) # Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5) # Set axis label style to 8pts Arial Bold c.xAxis().setLabelStyle("simsun.ttc", 9) c.yAxis().setLabelStyle("simsun.ttc", 9) # Set axis line width to 2 pixels c.xAxis().setWidth(2) c.yAxis().setWidth(2) c.yAxis2().setWidth(1) # Add axis title c.yAxis().setTitle("得分/Score", "simsun.ttc", 9) c.yAxis().setLinearScale(0, maxv) # Add a multi-bar layer with 3 data sets and 4 pixels 3D depth #~ layer = c.addBarLayer2(Side, 1) layer = c.addBarLayer() layer.setBarGap(0.1) layer.setBarWidth(170, 18) for index, series in enumerate(series_list): values = series['value'] if len(values) > 1: color = COLOR_BLUE else: values.append(future_score) if point == 93: color = COLOR_93 elif point == 87: color = COLOR_87 else: color = COLOR_BLUE name = utils.to_utf8(series['name']) if name == u'2012 Top3 Ave': color = COLOR_TOP3_AVE if name == u'2012 YTD': color = COLOR_YTD if name == u'2011 Ave': color = COLOR_AVE #print values, color, name write_list = [] for value in values: if value == -1 or value > 100: write_list.append(0) else: write_list.append(value) layer.addDataSet(write_list, color, name) for i, v in enumerate(values): if v == -1 or v > 100: if name in (u'2012 Top3 Ave', u'2012 YTD', u'2011 Ave'): layer.addCustomGroupLabel(index, i, " ") else: layer.addCustomGroupLabel(index, i, "N/A") else: layer.setAggregateLabelFormat("{value|1}") layer.setAggregateLabelStyle('', 10, '0x0000', 0) yMark = c.yAxis().addMark(point, '0x800080', '%s' % point) yMark.setLineWidth(1) yMark.setAlignment(TopCenter) # Set bar border to transparent. Use soft lighting effect with light direction from # top. layer.setBorderColor(Transparent, softLighting(Top)) #layer.setBorderColor(Transparent, barLighting(0.75, 2.0)) #layer.setAggregateLabelFormat("{value|1}") # output the chart return c.makeChart2(PNG)