Properties
ChartField Class Reference

Represents a single bar or sector of the chart. More...

List of all members.

Properties

uint Color [get, set]
 Gets or sets the color of the bar or sector.
int Index [get, set]
 Gets or sets the index of field from attribute table (.dbf) to take values from.
string Name [get, set]
 Gets or sets the name of the chart field.

Detailed Description

Represents a single bar or sector of the chart.

dot_inline_dotgraph_33.png

Graph description

The chart fields set mapping between bars or sectors of the chart and a fields in the attribute table of the shapefile (see Table). The visual reprsentation of chart field, either bar or sector, depends on Charts.ChartType property.

It's necessary to distinguish the index of bar or sector in the chart and the index of field in dbf table it is bound to. For example, in case the chart contains a single bar which is mapped to the 5-th field of the dbf table, the index of bar for Charts.get_Field() property will be 0 (as there is only one bar in the chart), while ChartField.Index() will return 5 (as it is mapped to the 5 field).

 Shapefile sf = some_shapefile;
 Charts charts = sf.Charts;
 charts.ChartType = tkChartType.chtBarChart;
 charts.ClearFields();
 
 // adds a first bar mapped to 6th field of dbf
 Utils utils = new Utils();
 ChartField bar = new ChartField();
 bar.Index = 5;
 bar.Color = utils.ColorByName(tkMapColor.Red);
 charts.AddField(bar);
 
 // adds one more bar mapped to 9th field
 charts.AddField2(8, utils.ColorByName(tkMapColor.Blue));  // index of field, color
 
 for (int i = 0; i < charts.NumFields; i++)
 {
    string s = string.Format("Bar index = {0}; mapped to field index = {1}", i, charts.get_Field(i).Index);
    Debug.Print(s + Environment.NewLine);
 }
 // the output:
 // Bar index = 0; mapped to field index = 5
 // Bar index = 1; mapped to field index = 8
New API 4.8:
Added in version 4.8
Examples:
IntersectionLength.cs.

Property Documentation

uint ChartField.Color [get, set]

Gets or sets the color of the bar or sector.

Examples:
IntersectionLength.cs.
int ChartField.Index [get, set]

Gets or sets the index of field from attribute table (.dbf) to take values from.

Examples:
IntersectionLength.cs.
string ChartField.Name [get, set]

Gets or sets the name of the chart field.

In most cases it should be set equal to the name of the .dbf field from which the data is taken, unless some more comprehensive alias is needed.

Examples:
IntersectionLength.cs.
 All Classes Files Functions Enumerations Properties