Package org.pepstock.charba.client.utils
Class AnnotationBuilder
- java.lang.Object
-
- org.pepstock.charba.client.utils.AnnotationBuilder
-
public final class AnnotationBuilder extends Object
Utility to have an image to apply to canvas of chart in order to add HTML custom information on chart.
The utility is leveraging onsvg+mxl
andforeignObject
elements.
The HTML content MUST be XML well-formed, following the xHTML specification, when passed as string.
This is the SVG XML tree, used:
<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}"> <foreignObject width="100%" height="100%"> <div xmlns="http://www.w3.org/1999/xhtml"> ... HTML XML well-formed content .... </div> </foreignObject> </svg>
Drawing the image on canvas, you could get the java script errorNS_ERROR_NOT_AVAILABLE
which means that if even the content is well-formed, it contains some invalid characters, not allowed in the xHTML.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Img
build(String htmlXmlContent, double width, double height)
Creates an image to apply to canvas with the HTML content (MUST BE XML well-formed) and width and height of the resulted image.static Img
build(BaseHtmlElement htmlXmlContent, double width, double height)
Creates an image to apply to canvas with the HTML content (passed as DOM element) and width and height of the resulted image.
-
-
-
Method Detail
-
build
public static Img build(BaseHtmlElement htmlXmlContent, double width, double height)
Creates an image to apply to canvas with the HTML content (passed as DOM element) and width and height of the resulted image. Drawing the image on canvas, you could get the java script errorNS_ERROR_NOT_AVAILABLE
which means that if even the content is well-formed, it contains some invalid characters, not allowed in the xHTML.- Parameters:
htmlXmlContent
- DOM element which represents the XML content to showwidth
- width of image to be createdheight
- height of image to be created- Returns:
- an image to apply to canvas
-
build
public static Img build(String htmlXmlContent, double width, double height)
Creates an image to apply to canvas with the HTML content (MUST BE XML well-formed) and width and height of the resulted image. Drawing the image on canvas, you could get the java script errorNS_ERROR_NOT_AVAILABLE
which means that if even the content is well-formed, it contains some invalid characters, not allowed in the xHTML.- Parameters:
htmlXmlContent
- HTML content to apply on canvas, must be XML well-formedwidth
- width of image to be createdheight
- height of image to be created- Returns:
- an image to apply to canvas
-
-