ChartData2D Component


Properties

color
  Specifies the data series color as an alpha-red-green-blue integer.
Data type: color
Designer Writable true No designer sample code available at this time.
Code Writeable true No code writing sample available at this time.
Code Readable true No code reading sample available at this time.

colors
  Specifies the data series colors as a list of alpha-red-green-blue integers. If there is more data than there are colors, the colors will be alternated in order. E.g. if there are two colors Red and Blue, the colors will be applied in the order: Red, Blue, Red, Blue, ...
Data type: array
Designer Writable false
Code Writeable true No code writing sample available at this time.
Code Readable true No code reading sample available at this time.

dataFileXColumn
  Value used when importing data from a DataFile component [Source](#ChartData2D.Source). The value represents the column to use from the DataFile for the x entries of the Data Series. For instance, if a column's first value is "Time", and a column value of "Time" is specified, that column will be used for the x values. If a value here is not specified, default values for the x values will be generated instead.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

dataFileYColumn
  Value used when importing data from a DataFile component [Source](#ChartData2D.Source). The value represents the column to use from the DataFile for the y entries of the Data Series. For instance, if a column's first value is "Temperature", and a column value of "Temperature" is specified, that column will be used for the y values. If a value here is not specified, default values for the y values will be generated instead.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

dataSourceKey
  Sets the Data Source key identifier for the value to import from the attached Data Source. An example is the tag of the TinyDB component, which identifies the value. The property is a Designer-only property, and should be changed after setting the Source component of the Chart Data component. A complete list of applicable values for each compatible source is as follows: * For TinyDB and CloudDB, this is the tag value. * For the AccelerometerSensor, the value should be one of the following: X Y or Z * For the GyroscopeSensor, the value should be one of the following: X Y or Z * For the LocationSensor, the value should be one of the following: latitude, longitude, altitude or speed * For the OrientationSensor, the value should be one of the following: pitch, azimuth or roll * For the Pedometer, the value should be one of the following: WalkSteps, SimpleSteps or Distance * For the ProximitySensor, the value should be distance. * For the BluetoothClient, the value represents the prefix to remove from the value. For instance, if values come in the format "t:12", the prefix can be specified as "t:", and the prefix will then be removed from the data. No value can be specified if purely numerical values are returned.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

elementsFromPairs
  Comma separated list of Elements to use for the data series. Values are formatted as follows: x1,y1,x2,y2,x3,y3. Values are taken in pairs, and an entry is formed from the x and y values.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

label
  Specifies the text for the data series label.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable true No code writing sample available at this time.
Code Readable true No code reading sample available at this time.

lineType
  Changes the Line Type of the Data Series, provided that the Data component is attached to a Chart that has the type set to a line-based Chart(applies to area and line Chart types). Valid types include linear, curved or stepped.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

pointShape
  Changes the Point Shape of the Data Series, provided that the Data component is attached to a Chart that has the type set to the Scatter Chart. Valid types include circle, square, triangle, cross, x.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

source
  Sets the Source to use for the Data component. Valid choices include AccelerometerSensor, BluetoothClient, CloudDB, DataFile, GyroscopeSensor, LocationSesnro, OrientationSensor, Pedometer, ProximitySensor TinyDB and Web components. The Source value also requires valid DataSourceValue, WebColumn or DataFileColumn properties, depending on the type of the Source attached (the required properties show up in the Properties menu after the Source is changed). If the data identified by the [DataSourceKey](#ChartData2D.DataSourceKey) is updated in the attached Data Source component, then the data is also updated in the Chart Data component.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

spreadsheetUseHeaders
  If checked, the first row of the spreadsheet will be used to interpret the x and y column values. Otherwise, the x and y columns should be a column reference, such as A or B.
Data type: boolean
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

spreadsheetXColumn
  Sets the column to parse from the attached Spreadsheet component for the x values. If a column is not specified, default values for the x values will be generated instead.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

spreadsheetYColumn
  Sets the column to parse from the attached Spreadsheet component for the y values. If a column is not specified, default values for the y values will be generated instead.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

webXColumn
  Value used when importing data from a Web component Source. The value represents the column to use from the Web for the x entries of the Data Series. For instance, if the contents of the Web are retrieved in JSON format, and an array with the "Time" tag exists, the "Time" column value can be specified to use that array.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

webYColumn
  Value used when importing data from a Web component Source. The value represents the column to use from the Web for the y entries of the Data Series. For instance, if the contents of the Web are retrieved in JSON format, and an array with the "Temperature" tag exists, the "Temperature" column value can be specified to use that array.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

class
  The styling class of the the component
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true No designer sample code available at this time.
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
addEntry Adds an entry with the specified x and y value. Values can be specified as text, or as numbers. For Line, Scatter, Area and Bar Charts, both values should represent a number. For Bar charts, the x value is rounded to the nearest integer. For Pie Charts, the x value is a text value.
chartdata2dName.addEntry(x, y)
x string
y string
changeDataSource Changes the Data Source of the component to the specified component Source with the specified key value. See the ChartData2D.Source property for applicable components. See the ChartData2D.DataSourceKey property for the interpretation of the keyValue. In the case of the DataFile and Web components, the keyValue is expected to be a CSV formatted string, where the first value corresponds to the x column, and the second value corresponds to the y value.
chartdata2dName.changeDataSource(source, keyValue)
source component
keyValue string
clear Removes all the entries from the Data Series.
chartdata2dName.clear()
doesEntryExist Returns a boolean value specifying whether an entry with the specified x and y values exists. The boolean value of true is returned if the value exists, and a false value otherwise. See ChartData2D.AddEntry for an explanation of the valid entry values.
chartdata2dName.doesEntryExist(x, y)
x string
y string
getAllEntries Returns all entries of the data series. The returned value is a list, where each element of the list is a list containing the values of the entry in order.
chartdata2dName.getAllEntries()
getEntriesWithXValue Returns all entries of the data series matching the specified x value. For a description of the format of the returned List, see ChartData2D.GetAllEntries
chartdata2dName.getEntriesWithXValue(x)
x string
getEntriesWithYValue Returns all entries of the data series matching the specified y value. For a description of the format of the returned List, see ChartData2D.GetAllEntries
chartdata2dName.getEntriesWithYValue(y)
y string
importFromCloudDB Imports data from the specified CloudDB component by taking the value identified by the specified tag value. The expected CloudDB value is a list formatted in the same way as described in ChartData2D.ImportFromList. Does not overwrite any data.
chartdata2dName.importFromCloudDB(cloudDB, tag)
cloudDB component
tag string
importFromDataFile Imports data from the specified DataFile component by taking the specified x column for the x values, and the specified y column for the y values. The DataFile's source file is expected to be either a CSV or a JSON file. Passing in empty test for any of the column parameters will result in the usage of default values which are the indices of the entries. For the first entry, the default value would be the 1, for the second it would be 2, and so on.
chartdata2dName.importFromDataFile(dataFile, xValueColumn, yValueColumn)
dataFile component
xValueColumn string
yValueColumn string
importFromList Imports the data from the specified list parameter to the data series. The list is expected to contain element which are also lists. Each list element is expected to have 2 values, the first one being the x value, and the second one being the y value. Invalid list entries are simply skipped. Existing data are not cleared.
chartdata2dName.importFromList(list)
list list
importFromSpreadsheet Imports data from the specified Spreadsheet component by taking the specified x column for the x values, and the specified y column for the y values. Prior to calling this function, the Spreadsheet component's ReadSheet method has to be called to load the data. The usage of the GotSheet event in the Spreadsheet component is unnecessary. Empty columns are filled with default values (1, 2, 3, ... for Entry 1, 2, 3, ...).
chartdata2dName.importFromSpreadsheet(spreadsheet, xColumn, yColumn, useHeaders)
spreadsheet component
xColumn string
yColumn string
useHeaders boolean
importFromTinyDB Imports data from the specified TinyDB component by taking the value identified by the specified tag value. The expected TinyDB value is a list formatted in the same way as described in ChartData2D.ImportFromList. Does not overwrite any data.
chartdata2dName.importFromTinyDB(tinyDB, tag)
tinyDB component
tag string
importFromWeb Imports data from the specified Web component by taking the specified x column for the x values, and the specified y column for the y values. Prior to calling this function, the Web component's Get method has to be called to load the data. The usage of the gotValue event in the Web component is unnecessary. The expected response of the Web component is a JSON or CSV formatted file for this function to work. Empty columns are filled with default values (1, 2, 3, ... for Entry 1, 2, 3, ...).
chartdata2dName.importFromWeb(web, xValueColumn, yValueColumn)
web component
xValueColumn string
yValueColumn string
removeDataSource Removes the currently attached Data Source from the Chart Data component. Doing so will result in no more updates from the Data Source being sent, however, the current data will not be removed.
chartdata2dName.removeDataSource()
removeEntry Removes an entry with the specified x and y value, provided it exists. See ChartData2D.AddEntry for an explanation of the valid entry values.
chartdata2dName.removeEntry(x, y)
x string
y string
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
entryClick Indicates that the user tapped on a data point in the chart. The x and y values of the tapped entry are reported.
chartdata2dName.addEventListener(
    "entryClick",
    function (x, y) {
        //Your code here
    }
)
x any
y number