Ticket #5: rotate-x.patch
| File rotate-x.patch, 1.6 kB (added by jae@…, 4 years ago) |
|---|
-
chart.py
17 17 18 18 import copy 19 19 import cairo 20 import math 20 21 21 22 from pycha.color import (defaultColorscheme, getColorscheme, hex2rgb, 22 23 DEFAULT_COLOR) … … 349 350 cx.line_to(x, y + self.options.axis.tickSize) 350 351 cx.close_path() 351 352 cx.stroke() 353 cx.fill() 352 354 355 cx.new_path() 353 356 label = unicode(tick[1]) 354 357 extents = cx.text_extents(label) 355 358 labelWidth = extents[2] 356 359 labelHeight = extents[3] 357 cx.move_to(x - labelWidth / 2.0, 360 if self.options.axis.x.rotate: 361 cx.move_to(x, y + self.options.axis.tickSize + 10) 362 degrees = self.options.axis.x.rotate 363 cx.rotate(degrees*math.pi/180.) 364 cx.show_text(label) 365 cx.rotate(-degrees*math.pi/180.) 366 else: 367 cx.move_to(x - labelWidth / 2.0, 358 368 y + self.options.axis.tickSize + 10) 359 cx.show_text(label)369 cx.show_text(label) 360 370 return label 361 371 for tick in self.xticks: 362 372 drawXLabel(tick) … … 456 466 tickCount=10, 457 467 tickPrecision=1, 458 468 range=None, 469 rotate=None, 459 470 ), 460 471 y=Option( 461 472 hide=False,
