How to display the dynamic information of a vertex in a static graph (C # + Delphi)
In terms of business, you need to analyze an element in a static graph. For example, you want to know the coordinate value of a point (move the mouse to this point to display the relevant value ), and the relevant data source behind it (Click here to open a new window and display more relevant data ). Therefore, when a fixed-size graph is generated, the absolute coordinate values of the corresponding vertex information are also recorded, and the map function in HTML is used, the dynamic information of a point can be displayed in a static graph.
It consists of three steps: 1. Generate the absolute coordinate value of the vertex in the graph (completed in Delphi), 2. Generate the image, associate the coordinate value, and click event of the vertex (completed in Delphi ), 3. Click Event at the response point (C #)
1. Generate the absolute coordinate value of the vertex in the graph (completed in Delphi)
Obtain the absolute coordinate value of the hotspot on the tchart image. The key code is as follows:
Procedure tsvgexportform. button22click (Sender: tobject );
VaR
Temps1: string;
I, X, Y: integer;
Begin
Temps1: = ' ';
Temps1: = temps1 + '<Map Name = "map1"> ';
For I: = 0 to chart1.series [0]. Count-1 do
Begin
X: = chart1.series [0]. calcxpos (I );
Y: = chart1.series [0]. calcypos (I );
Temps1: = temps1 + '<area href =' + '/page4? 1 = '+
'& 2 =' + chart1.series [0]. xlabel [I] + '"target =" _ blank "' +
'Shape = "circle" coords = "'+ inttostr (x) +', '+ inttostr (y) +', 2" '+
'Alt = "'+ chart1.series [0]. xlabel [I] + ',' + format ('% 12.4f', [chart1.series [0]. yvalue [I]) + '> ';
End;
Temps1: = temps1 + '</map> ';
End;
2. generate an image, associate the coordinate value with the click event of the vertex (completed in Delphi)
Save the preceding image and Hotspot information and save it as an HTML file. The image file name is test.bmp. There are nine vertices in the format:
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML> <Meta http-equiv = Content-Type content = "text/html; charset = gb2312">
<Meta content = "mshtml 6.00.2900.3132" name = generator> <Body>
<Map Name = "map1">
<Area href = "/page4? 1 = & 2 = 1 "target =" _ blank "shape =" circle "coords =" 67,68, 2 "alt =" 1, 99.9800 ">
<Area href = "/page4? 1 = & 2 = 2 "target =" _ blank "shape =" circle "coords =" 170,50, 2 "alt =" 2,100.0000 ">
<Area href = "/page4? 1 = & 2 = 3 "target =" _ blank "shape =" circle "coords =" 272,504, 2 "alt =" 3, 99.5000 ">
<Area href = "/page4? 1 = & 2 = 4 "target =" _ blank "shape =" circle "coords =" 375,68, 2 "alt =" 4, 99.9800 ">
<Area href = "/page4? 1 = & 2 = 5 "target =" _ blank "shape =" circle "coords =" 478,232, 2 "alt =" 5, 99.8000 ">
<Area href = "/page4? 1 = & 2 = 6 "target =" _ blank "shape =" circle "coords =" 581,77, 2 "alt =" 6, 99.9700 ">
<Area href = "/page4? 1 = & 2 = 7 "target =" _ blank "shape =" circle "coords =" 684,50, 2 "alt =" 7,100.0000 ">
<Area href = "/page4? 1 = & 2 = 8 "target =" _ blank "shape =" circle "coords =" 786,59, 2 "alt =" 8, 99.9900 ">
<Area href = "/page4? 1 = & 2 = 9 "target =" _ blank "shape =" circle "coords =" 889,50, 2 "alt=" 9,100.0000 ">
</Map>
</Body>
</Html>
3. Click Event at the response point (C #)
Showdialog
This is: