This article is purely a personal opinion and a summary of previous studies. If the descriptions are incorrect, please correct them ~
Due to the chaos in the previous article, I reorganized my thoughts and uploaded an example.
The following is a record of issues solved by applying SVG to the export function provided by highcharts. js.
When applying SVG render Enginee, you must master the following problems:
1. In the first line of the SVG string, I got two xmlns on weekdays;
2. Apply svgdocment in lineargradient to call the draw method, resulting in memory overflow.
See:
3. When text-anchor is applied in the text section, the memory overflow may occur.
<Text style = "Font: 11px/normal trebuchet MS, verdana, sans-serif; width: pixel; color: RGB (0, 0, 0); cursor: default; font-size-adjust: none; font-stretch: normal; fill: #000; "opacity =" 1 "text-anchor =" Middle "x =" 152.7857 "Y =" 331 "> <tspan x =" 152.7857 "> XX high speed </tspan> </ text>
4. text is not displayed when the text node is used for export.
Solution:
Question 1: Apply string replacement, replace "<SVG xmlns =" http://www.w3.org/2000/svg "with" <SVG ";
Question 2: ModifySource code, Svglineargradientserver. CS when instantiating lineargradientbrush, because start is the end, the problem occurs. When start is the end, the end X and Y are added with 1;
Question 3: Modify the SVG SourceCodeOthers have introduced Enum svgvisibility, but you also need to modify it in line 87 of svgvisualelement. CS as follows:
If (this. path! = NULL & visible = svgvisibility. Visible)
Is:
If (this. path! = NULL & (visible = svgvisibility. Visible | visible = svgvisibility. inherit ))
Problem 4: Because svgtext reads the fontsize as 0, modify svgtext. CS in line 3 as follows:
Float fontsize = This. fontsize. todevicevalue (this); If (fontsize = 0.0f) {fontsize = 10.0f;} int stringwidth;
Then, the new re-upload demo and the modified SVG. dll can be directly called.
Because csdn cannot upload files, I upload them to the source resource, so that you can download them directly.
Note: The application vs2010 is successfully tested.
The link is as follows:
Http://download.csdn.net/detail/fly_miss/5279632
The effect of opening a webpage is as follows:
The export effect is as follows:
ArticleLet's end by sharing with you.ProgramJokes and quotations:
Programmers drink
I occasionally adopt "Trojan strategy" and "cross-test". In a short period of time, I began to "frequently allocate and release resources". "cache" is also inevitable,
However, I never conduct "round patrols", nor "catch exceptions", nor "program exceptions", because I have a rational
Restrained.