Visit Gigasoft's Web Site
ProEssentials v11 Help

Chapter 2: ProEssentialsJS Example Code

 

The example numbers are the same numbers. This help refers to examples such as 030, 122 and 202 throughout. Those refer to the same charts in JavaScript as they do in PEDEMO.EXE and in the .NET, VCL and MFC example projects. An example number cited anywhere in this help can be opened in the browser.

 

114 examples are available in JavaScript.

 

The Series

Series

Count

Object

000 37 Graph, Pego
100 48 Scientific Graph, Pesgo
200 7 Polar, Smith and Rose, Pepso
300 4 Pie Chart, Pepco
400 18 3D Scientific Graph, Pe3do

 

In the desktop example projects the 000 series is in Form2, the 100 series in Form3, the 200 series in Form4, and so on. For the MFC project all of them are in PEview.cpp.

 

The Shape Of An Example

Each example is a module. It declares its number and title, and a build function that receives the chart object and the enumerations. There is no shell code inside an example, which is what lets the same source be read as documentation and run as a chart.

export const id = '000';
export const title = '*** Simple Graph ***';

export function build(Pego1, E) {
  Pego1.PeData.Subsets = 4;
  Pego1.PeData.Points = 12;
  // ... properties ...
}

 

Every example is a transliteration of the desktop example, property for property and in the same order. Where the desktop example uses a feature that has no browser equivalent, the example says so in a comment rather than quietly doing something else.

 

Real-Time Examples

Eight examples update live: 017, 115, 116, 117, 118, 145, 146 and 148. Example 017 is the classic strip chart, one new sample per subset appended on a timer with the clock as the point label. See Real-Time Charts.

 

Reading Them

The example browser at gigasoft.com shows each chart beside its own source, so the code you read is the code that drew the chart above it. The examples are also included with the product.

 

Because the property names are the .NET property names, the desktop example projects are useful JavaScript references too. A C# example transliterates: the two-dimensional indexer, the enum prefix, camelCase on the array helper methods, and the final call. See ProEssentialsJS Overview.

 

Next

ProEssentialsJS Walkthrough, Installation, Deployment, Real-Time Charts, Events.