| Table of Contents | |
|---|---|
| 1. Problem | |
| 2. Solution | |
| 3. Sample Output | |
| 4. Sample Code | |
| 5. WWW Page | |
Nasdaq was working on their first public web site and wanted to present near real-time graphs for their various indexes.
They had been working with their in-house group reponsible for the design and appearance of all Nasdaq products. The group had designed the web site and expected the appearance to be exactly as they had defined.
After working with various Microsoft and COTS graphing/charting packages for several months the engineering group was unable to create graphs/charts acceptable to the design group.
I had previously created similar appearing charts, in PostScript, for another hard copy product, the Corporate Record, produced by Nasdaq.
The design group remembered the graphs and ended up referring the engineering group to me.
The code needed to run in a Microsoft Windows NT environment. The needed to finalize size and placment of the graphs so the code needed to be flexible. It also needed to be done quickly as it was March and they wanted to roll out their web site in July.
It was written in C and developed on a HPUX system. The code was then tested on a Sun Solaris server and then the code was imported into a Microsoft Visual C environment under Windows NT and a DLL was created.
The DLL was used during the first three generations of the Nasdaq web site

The Nasdaq Composite for March 1, 1996

The Nasdaq Composite for March 7, 1996
if ( (ent->time[0]%100) < 10 ) {
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*0.0),
graph_height+TOP_MARGIN,
x_line_offset+1+(long)(x_interval*0.0),
graph_height + 2+TOP_MARGIN,
label_color );
gdImageString( summary_gif, gdFontSmall,
x_line_offset+1+(long)(x_interval*0.0) + 1,
graph_height + 3+TOP_MARGIN,
months[last_month], label_color );
}
for ( indx = 1; indx < ent->data1_indx; indx++ ) {
if ( ! (flags[indx-1] & ND_NULL)
&& ! (flags[indx] & ND_NULL) ) {
int x = x_line_offset+1+(x_interval*indx);
int y;
if ( indx == ent->data1_indx - 1 ) {
points[0].x = x_line_offset+1+graph_width-2;
points[0].y = Y_VOLUME_CALC( volume[indx] );
points[1].x = x_line_offset+1+(long)(x_interval*(double)(indx-1));
points[1].y = Y_VOLUME_CALC( volume[indx-1] );
points[2].x = x_line_offset+1+(long)(x_interval*(double)(indx-1));
points[2].y = graph_height-1+TOP_MARGIN;
points[3].x = x_line_offset+1+graph_width-2;
points[3].y = graph_height-1+TOP_MARGIN;
gdImageFilledPolygon( summary_gif, points, 4, volume_color );
} else {
points[0].x = x_line_offset+1+(long)(x_interval*(double)indx);
points[0].y = Y_VOLUME_CALC( volume[indx] );
points[1].x = x_line_offset+1+(long)(x_interval*(double)(indx-1));
points[1].y = Y_VOLUME_CALC( volume[indx-1] );
points[2].x = x_line_offset+1+(long)(x_interval*(double)(indx-1));
points[2].y = graph_height-1+TOP_MARGIN;
points[3].x = x_line_offset+1+(long)(x_interval*(double)indx);
points[3].y = graph_height-1+TOP_MARGIN;
gdImageFilledPolygon( summary_gif, points, 4, volume_color );
}
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VOLUME_CALC( volume[indx] ),
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VOLUME_CALC( volume[indx-1] ),
volume_outline_color );
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VALUE_CALC( data[indx] ),
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VALUE_CALC( data[indx-1] ),
value_color );
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VALUE_CALC( data[indx] ) + 1,
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VALUE_CALC( data[indx-1] ) + 1,
value_color );
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VALUE_CALC( data[indx] ) - 1,
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VALUE_CALC( data[indx-1] ) - 1,
value_color );
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VALUE_CALC( data[indx] ) + 2,
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VALUE_CALC( data[indx-1] ) + 2,
value_outline_color );
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx),
Y_VALUE_CALC( data[indx] ) - 2,
x_line_offset+1+(long)(x_interval*(double)(indx-1)),
Y_VALUE_CALC( data[indx-1] ) - 2,
value_outline_color );
if ( ((ent->time[indx]/100)%100) != last_month ) {
int day = (ent->time[indx]%100);
last_month = ((ent->time[indx]/100)%100);
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx)-day,
graph_height+TOP_MARGIN,
x_line_offset+1+(long)(x_interval*(double)indx)-day,
graph_height + 2+TOP_MARGIN,
label_color );
if ( (long)(x_line_offset+1+(long)(x_interval*(double)ent->data1_indx)) - (long)(x_line_offset+1+(long)(x_interval*(double)indx)+1-day) > 19 ) {
gdImageString( summary_gif, gdFontSmall,
x_line_offset+1+(long)(x_interval*(double)indx)+1-day,
graph_height + 3+TOP_MARGIN,
months[last_month], label_color );
}
if ( ctl->x_grid_on ) {
gdImageLine( summary_gif,
x_line_offset+1+(long)(x_interval*(double)indx)-day,
0+TOP_MARGIN,
x_line_offset+1+(long)(x_interval*(double)indx)-day,
graph_height - 1+TOP_MARGIN,
grid_color );
}
}
}
}
![]()
Daily Nasdaq Composite Index Value and Volume as of Oct. 17, 96
The Nasdaq Web Site uses technology from the following Nasdaq listed companies:
© Copyright 1996, The Nasdaq Stock Market, Inc. All Rights Reserved.
|
| For more information contact: | |
| Steve Monroe | |
| Phone: 540-822-3946 | |
| Internet: steve@pcthree.com | |