mx.charts

# HitData - AS3 Flex

Package | mx.charts
Class | public class HitData
Inheritance | HitData Object

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The HitData class represents information about the data item at a specific location on the screen. Flex returns the HitData structure for mouse events on chart data points. It describes what data points are under the current mouse position.

You can also get a HitData structure describing the data point at a specific location in the chart using the chart control's `findDataPoints()` method.

More examples

Using the HitData object
Changing mouse sensitivity
Drilling down into data

Related API Elements

mx.charts.ChartItem

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | chartItem : ChartItem The chart item described by the hit data. | HitData
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | contextColor : uint = 0 An RGB value that can be used to associate an on-screen representation of the associated chartItem. | HitData
|  | dataTipFunction : Function A function provided by the HitData creator to generate a user-suitable String for display on screen that describes the referenced item. | HitData
|  | displayText : String [read-only] A description of the associated item for display on screen. | HitData
|  | distance : Number Specifies the distance between the data item on the screen and the location of the mouse pointer, in pixels. | HitData
|  | element : IChartElement [read-only] Specifies the chart element rendering this data item that generated the HitData structure. | HitData
|  | id : Number Specifies a unique identifier representing the data point. | HitData
|  | item : Object Specifies the data item that the HitData structure describes. | HitData
|  | x : Number Specifies the X coordinate of the data item on the screen. | HitData
|  | y : Number Specifies the Y coordinate of the data item on the screen. | HitData

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | HitData(id:Number, distance:Number, x:Number, y:Number, chartItem:ChartItem) Constructor. | HitData
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### chartItem

property

`public var chartItem:ChartItem`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The chart item described by the hit data. A chart item represents the data a series uses to describe an individual item from its `dataProvider`.

### contextColor

property

`public var contextColor:uint = 0`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

An RGB value that can be used to associate an on-screen representation of the associated `chartItem`. DataTips use this field to help render their data.

### dataTipFunction

property

`public var dataTipFunction:Function`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

A function provided by the HitData creator to generate a user-suitable String for display on screen that describes the referenced item.

### displayText

property

`displayText:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

A description of the associated item for display on screen.

Implementation
`public function get displayText():String`

### distance

property

`public var distance:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the distance between the data item on the screen and the location of the mouse pointer, in pixels.

### element

property

`element:IChartElement` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the chart element rendering this data item that generated the HitData structure.

Implementation
`public function get element():IChartElement`

### id

property

`public var id:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies a unique identifier representing the data point. You can use this identifier to test for equality between two HitData objects. If two different chart elements represent the same `dataProvider` entry, they will have two different identifiers.

### item

property

`public var item:Object`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the data item that the HitData structure describes.

### x

property

`public var x:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the X coordinate of the data item on the screen.

### y

property

`public var y:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the Y coordinate of the data item on the screen.

Constructor Detail

### HitData

()
Constructor

`public function HitData(id:Number, distance:Number, x:Number, y:Number, chartItem:ChartItem)`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Constructor.

Parameters

| `id:Number` — Specifies a unique identifier representing the data point.
| `distance:Number` — Specifies the distance between the data item on the screen and the location of the mouse pointer, in pixels.
| `x:Number` — Specifies the x coordinate of the data item on the screen.
| `y:Number` — Specifies the y coordinate of the data item on the screen.
| `chartItem:ChartItem` — The chart item described by the hit data.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00