Web statistic chart solution

zhaozj2021-02-08  290

Xu Changyou

With the rise of Internet technology, there are more and more procedures for B / S structures. There are many ways to implement statistical charts on the web, and it is more difficult to achieve relative to general application. This paper mainly introduces the implementation method of the Web statistic chart, and statistics and analysis of various information, in order to provide the decision-making basis, the image-expressing analysis results, allowing information with column chart, line chart, and round cake diagrams, combined with data warehouse to rotate to intuitive The form is exhibited! In many projects, you need to use charts. For some online articles, most of the B / S structures use MS Chart, Shortgraph, Aspchart and other components, most of which are developed by foreign software companies, and need Money The final effect doesn't look very much (personal thinking), and there is a very shortcoming, such as the MS Chart client has Office, otherwise it will not be available. There are also some applets, such as the Java Chart kit, this kit is written by Java, suitable for browsers that support Java Applet, if you don't have Java, the general application is difficult to use.

This article provides a statistic chart solution to you, of course, you can fully use all where ActiveX, not just the web. After reading this article, I think you can also complete the chart via ASP, VBScript, JavaScript. The most important thing is that you can write Copyright (C), YourCompany ..., the client makes the browser automatically download registration, no need to install.

Here, use Delphi simple development ActiveX that can generate a chart on the browser (the same as BCB development, just the code is a bit different):

First, open Delphi, select Acitvex Form in New Item Winzard in New Item Winzard in New Item Winzard, select you according to you, here you can choose, here you can choose from INCLUDE ABOUTBOX Such Delphi will automatically generate a dialog. Place a TCHART component in the MyChart window, TCHART adds a BAR-shaped Series, which can be set by itself. This article only provides a brief introduction, it is recommended to dynamically generate series.

In the menu view-> type libary, two methods are added separately:

Add_Data and Clear_Data, the role is to add data and clear data, respectively.

Adding two parameters in the Add_Data method (ANUM, Type: Double, Aname, Type: BSTR, MODIFIER is set to IN)

code show as below:

Procedure Tmychart.Add_data (ANUM: DOUBLE; Const Aname: WideString);

Begin

Series1.Add (Anum, Aname, CLTeecolor);

END;

Procedure Tmychart.clear_data;

Begin

SERIES1.CLEAR;

END;

Set the AboutBox, add a TPopupMenu in the MyChart window, and the user pop-up menu sees about the dialog. Add a MenuItem setting CAPTION: = "About (& A), the onclick code is as follows:

Procedure Tmychart.pm_aboutclick (sender: TOBJECT);

Begin

ShowmyChartabout;

END; the role is to display the PopupMenu set to the dialog and set TCHART to add a TPopUpMenu!

If the engineering name is not changed, compile to generate myChartProj1.ocx, and register this control can be used.

For browsers, you can use the following method to let other automatic registration it:

Delphi Sets the Web Publishing option through Project-> Web Deloyment Options, simply set as follows:

Target Dir: C: / Document and Settings / Administrator / Desktop / Chart / HTML

Target URL:.

HTML DIR: C: / Document and Settings / Administrator / Desktop / Chart / HTML

Then generate two files, one html, another OCX file by menu Project -> Web Deploy in a C: / Document and Settings / Administrator / Desktop / Chart / HTML directory.

Here, change the HTML file plus an id = mychart1, then add some VBScript code as follows:

Delphi 5 Acitvex Test Page

You Should See You Delphi 5 Forms or Controls Embedded in The Form Below


ClassID = "CLSID: B977D48F1-4DDA-4F00-9781-EC7BA3278CBD"

Codebase = "./mychartproj1.oxc#version=1, 0, 0, 0"

Width = 538

HEIGHT = 350

Align = center

HSPACE = 0

vSpace = 0

>