class PtBarGraph PtBasic { bargraph_base; // short bargraph_color; // color array bargraph_data; // bar data array bargraph_depth; // short bargraph_flags; // flag bargraph_grid_color; // color bargraph_grid_horiz; // short bargraph_grid_vert; // short bargraph_max; // short bargraph_min; // short }
This widget creates a bar graph from a data array. It features an adjustable baseline, user-assigned bar colors, and an optional grid. The bars automatically adjust their width to fill the width of the widget.
![]() | This widget does not appear in the Photon documentation. |
Flags that allow you to specify various options, of which only one is currently available.
This instance variable may be a combination of zero or more of the following flags:
| Constant | Description |
|---|---|
| Pt_BARGRAPH_GRID | Puts a grid on the bargraph. Default is ON. |
This example, ex_PtBarGraph.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma
/*
* This example demonstrates a PtBarGraph, using data with steadily
* decreasing values. The baseline is set to -50, and green_tinted colors
* have been specified for all the positive numbers. The 39 horizontal
* grid lines divide the graph into 40 equal horizontal sections, while
* the 8 vertical gridlines make 9 equal vertical sections.
*/
require_lisp("PhotonWidgets.lsp");
PtInit(nil);
win = new(PtWindow);
win.SetDim (325,325);
bgf = new(PtBarGraph);
bgf.SetArea (10,10,300,300);
bgf.fill_color = 0xaabfaa;
bgf.bargraph_base = -50;
bgf.bargraph_color = array(0xcceecc, 0xaaeeaa, 0x77ee77, 0x55ee55);
bgf.bargraph_data = array(150,100,50,25,0,-25,-50,-100,-150);
bgf.bargraph_depth = 3;
bgf.bargraph_flags = Pt_BARGRAPH_GRID;
bgf.bargraph_grid_color = 0x00aaff;
bgf.bargraph_grid_horiz = 8;
bgf.bargraph_grid_vert = 39;
bgf.bargraph_max = 200;
bgf.bargraph_min = -200;
princ(hex(bgf.bargraph_max),"\n");
princ(bgf.bargraph_min,"\n");
PtRealizeWidget(win);
PtMainLoop();
Copyright © 1995-2012 by Cogent Real-Time Systems, Inc. All rights reserved.