Chart Class Reference

Represents a single chart on the map. More...

Collaboration diagram for Chart:
Collaboration graph

Properties

bool IsDrawn [get, set]
 Returns a boolean value which indicates whether the chart is currently displayed on the map. More...
 
double PositionX [get, set]
 Gets or set the horizontal position of chart in map units. More...
 
double PositionY [get, set]
 Gets or sets the vertical position of the chart in map units. More...
 
Extents ScreenExtents [get]
 Returns the rectangle which the chart occupies on the screen. More...
 
bool Visible [get, set]
 Gets or sets the value which indicates whether the chart should be drawn on the map. More...
 

Detailed Description

Represents a single chart on the map.

dot_inline_dotgraph_36.png

Graph description

The number of bars or sectors depends on the number of charts fields specified in the instance of the Charts class it belongs to. In the same way the visualization options depends in the corresponding settings of the Charts class. Each chart borrows it's data from attribute table of shapefile (see Table). So the only way to change the height of individual bars is to modify the values in the underlying .dbf table.

This class isn't meant for creation of the new charts but only for modification of position and visibility of the existing ones. Initially charts are generated by using Charts.Generate() method. Afterwards to access a single chart Charts.get_Chart() property can be used.

// let's assume we need to change the properties of the chart for the 17-th shape of the shapefile
public void ModifyChart(AxMap map, Shapefile sf)
{
int shapeIndex = 16; // shape indices are 0-based
// retrieving chart object
Chart chart = sf.Charts.get_Chart(shapeIndex);
if (chart != null)
{
// is it currently displayed on the screen?
MessageBox.Show("The chart is drawn: " + chart.IsDrawn.ToString());
chart.PositionX += 10.0; // let's move it to the right by 10 map units
chart.PositionY -= 5.0; // let's move it to the bottom by 5 map units
chart.Visible = true; // ensure that it's visible
map.Redraw(); // redraw is needed to see the changes of position
}
else
{
MessageBox.Show(string.Format("The chart with index {0} doesn't exists", shapeIndex));
}
}
New API 4.8:
Added in version 4.8

Property Documentation

◆ IsDrawn

bool Chart.IsDrawn
getset

Returns a boolean value which indicates whether the chart is currently displayed on the map.

Chart can be left undrawn because of the following reasons:

  • shapefile layer is set invisible;
  • dynamic visibility activated for the shapefile layer or charts;
  • chart is located outside the current map extents;
  • all the charts or this particular chart were set to be invisible;
  • it overlaps already drawn charts and Charts.AvoidCollisions is set to true.

◆ PositionX

double Chart.PositionX
getset

Gets or set the horizontal position of chart in map units.

◆ PositionY

double Chart.PositionY
getset

Gets or sets the vertical position of the chart in map units.

◆ ScreenExtents

Extents Chart.ScreenExtents
get

Returns the rectangle which the chart occupies on the screen.

This property will return NULL in case Chart.IsDrawn returns false.

◆ Visible

bool Chart.Visible
getset

Gets or sets the value which indicates whether the chart should be drawn on the map.

Setting this property to true doesn't mean that it actually will be displayed on the map (see Chart.IsDrawn).