def fit(self): bbox = defaults.BBox(None, None, None, None) for child in self.children: bbox += child.bbox() if self.xmin is not None: bbox.xmin = self.xmin if self.xmax is not None: bbox.xmax = self.xmax if self.ymin is not None: bbox.ymin = self.ymin if self.ymax is not None: bbox.ymax = self.ymax self.trans = trans.window(bbox.xmin, bbox.xmax, bbox.ymin, bbox.ymax, x=self.x, y=self.y, width=self.width, height=self.height, xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinityX=(self.x - 10. * self.width), minusInfinityY=(self.y - 10. * self.height), flipx=self.flipx, flipy=self.flipy)
def fit(self): bbox = defaults.BBox(None, None, None, None) for child in self.children: bbox += child.bbox() if self.xmin is not None: bbox.xmin = self.xmin if self.xmax is not None: bbox.xmax = self.xmax if self.ymin is not None: bbox.ymin = self.ymin if self.ymax is not None: bbox.ymax = self.ymax self.trans = trans.window(bbox.xmin, bbox.xmax, bbox.ymin, bbox.ymax, x=self.x, y=self.y, width=self.width, height=self.height, xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinityX=(self.x - 10.*self.width), minusInfinityY=(self.y - 10.*self.height), flipx=self.flipx, flipy=self.flipy)
def svg(self): if (self.xmin is not None and self.xmax is not None and self.ymin is not None and self.ymax is not None): self.trans = trans.window( self.xmin, self.xmax, self.ymin, self.ymax, x=self.x, y=self.y, width=self.width, height=self.height, xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinityX=(self.x - 10. * self.width), minusInfinityY=(self.y - 10. * self.height), flipx=self.flipx, flipy=self.flipy) else: self.fit() self._svg = new.instance(svg.SVG) self._svg.__dict__["tag"] = "g" self._svg.__dict__["attrib"] = self.attrib self._svg.__dict__["_svg"] = self._svg self._svg.__dict__["children"] = [] for child in self.children: self._svg.__dict__["children"].append( trans.transform(self.trans, child)) if self.clip: clipPath = svg.SVG("clipPath", id=svg.randomid("clip-"))(svg.SVG( "rect", self.x, self.y, self.width, self.height)) self._svg["clip-path"] = "url(#%s)" % clipPath["id"] self._svg = svg.SVG("g", clipPath, self._svg)
def svg(self): if (self.xmin is not None and self.xmax is not None and self.ymin is not None and self.ymax is not None): self.trans = trans.window(self.xmin, self.xmax, self.ymin, self.ymax, x=self.x, y=self.y, width=self.width, height=self.height, xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinityX=(self.x - 10.*self.width), minusInfinityY=(self.y - 10.*self.height), flipx=self.flipx, flipy=self.flipy) else: self.fit() self._svg = new.instance(svg.SVG) self._svg.__dict__["tag"] = "g" self._svg.__dict__["attrib"] = self.attrib self._svg.__dict__["_svg"] = self._svg self._svg.__dict__["children"] = [] for child in self.children: self._svg.__dict__["children"].append(trans.transform(self.trans, child)) if self.clip: clipPath = svg.SVG("clipPath", id=svg.randomid("clip-"))(svg.SVG("rect", self.x, self.y, self.width, self.height)) self._svg["clip-path"] = "url(#%s)" % clipPath["id"] self._svg = svg.SVG("g", clipPath, self._svg)