Selecting a Graph Type

Your most important choice about your chart is the type of graph that is used to represent your data. Chapter 6 Chart Types described the various graph and axis types supported by Objective Chart. The Wizard Demo sample application can help you or your end-user select the chart type that is most appropriate for the data.

Chart styles may be chosen by setting two main styles in the m_Style member of the display component. These styles are the graph type using the CX_GRAPH_XXXXX styles and the axis type using the CX_AXIS_XXXXX styles. These styles may be set using the SRGraphStyle::SetGraphStyle() and SRGraphStyle::SetAxisStyle() functions.

For example, the following code segment creates a display component that displays a pie chart that covers the entire screen.

 

SRGraphDisplay *pD=new SRGraphDisplay;

pD->GetStyle()->SetGraphStyle(CX_GRAPH_PIE);

pD->GetStyle()->SetAxisStyle(CX_AXIS_AUTOMATIC);

pD->SetMeasurement(SRGraphComponent::PERCENT);

pD->SetRect(-1,-1,-1,-1);

m_Graph.AddComponent(pD);

The tables below list the standard graph and axis styles in Objective Chart. The third table shows which axis types are supported for the various graph types.

List of Graph Styles

Graph Style

Description

CX_GRAPH_NONE

No style defined

CX_GRAPH_LINE

Simple line plot with wigets

CX_GRAPH_LINEONLY

Line only (no wigets)

CX_GRAPH_AREA

Area under a curve

CX_GRAPH_STEP

Step chart

CX_GRAPH_STEPLO

Step chart — line only

CX_GRAPH_VBAR

Simple vertical bar chart

CX_GRAPH_HBAR

Simple horizontal bar chart

CX_GRAPH_STACK_VBAR

2D stacked vertical bars (not summed)

CX_GRAPH_STACK_HBAR

2D stacked horizontal bars (not summed)

CX_GRAPH_EX_VBAR

Extended VBar (Pseudo 3D)

CX_GRAPH_EX_HBAR

Extended HBar (pseudo 3D horizontal bars)

CX_GRAPH_STRATA

Strata graph (summed)

CX_GRAPH_STRATAVBAR

Strata vertical bar (one index per bar)

CX_GRAPH_STRATAHBAR

Strata horizontal bar (one index per bar)

CX_GRAPH_STRATAVBARG

Strata vertical bar (one group per bar)

CX_GRAPH_STRATAHBARG

Strata horizontal bar (one group per bar)

CX_GRAPH_STOCK

Highs, lows, and now (or close)

CX_GRAPH_AREASTOCK

Area style stock quote (hi-low)

CX_GRAPH_CANDLE

Candle chart style

CX_GRAPH_HILO_OPENCLOSE

Hi-Low Open Close chart

CX_GRAPH_FREESTYLE

Classic graph with free style objects

CX_GRAPH_PIE

Pie chart

CX_GRAPH_ISO_PIE

3D pie chart

CX_GRAPH_ISO_BAR

3D Manhattan graph

CX_GRAPH_ISO_AREA

3D Rooftop graph

CX_GRAPH_RIBBON

Ribbon graphs are rooftop graphs without sides or ends.

CX_GRAPH_XYSCATTERA

Scatter plot using alternate X and Y values

CX_GRAPH_XYSCATTERG

Scatter plot: even groups = Xs and odd groups = Ys

CX_GRAPH_XYSCATTERI

Scatter plot: even indices = Xs and odd indices = Ys

CX_GRAPH_XYSCATTERA_EX

Scatter charts with log/linear axis differentiation

CX_GRAPH_XYSCATTERG_EX

Scatter charts with log/linear axis differentiation

CX_GRAPH_XYSCATTERI_EX

Scatter charts with log/linear axis differentiation

CX_GRAPH_BUBBLE_R

Bubble chart, radius proportional to size variable

CX_GRAPH_BUBBLE_A

Bubble chart, area proportional to size variable

CX_GRAPH_VECTOR_E

Vector chart, angle+magnitude, tail at x-y position

CX_GRAPH_VECTOR_C

Vector chart, angle+magnitude, midpoint at x-y position

CX_GRAPH_VECTOR_G

Vector chart, two end points

CX_GRAPH_GANTT

Gantt chart

CX_GRAPH_POLAR

Polar chart with phase and magnitude

CX_GRAPH_AREAPOLAR

Polar chart with filled areas

CX_GRAPH_WEB

Web charts are polar or radar graphs

CX_GRAPH_AREAWEB

Web chart with filled areas

CX_GRAPH_HISTOGRAM

Histogram or frequency spectrum1

CX_GRAPH_OSCILLISCOPE

Dynamic multiple plots1

CX_GRAPH_TIMESPAN

Horizontal time-span bars1

CX_GRAPH_USER

User styles are in the range 00c00000 to 00ff0000; all other values are .reserved