var chart = new Cosfire.Chart("chart-div",{width:700,
height:250});
axesX: [{title: 'Country'}];
axesY: [{title: 'Population',
valueFormatRange: [1000, "K", 1000000, "M"]
}];
/* Create instance of DataSeries */
data: [{
plotAs: 'column',
points: [
{xLabel: "China", y: 1439323776},
{xLabel: "India", y: 1380004385},
{xLabel: "Indonesia", y: 273523615},
{xLabel: "Pakistan", y: 220892340},
{xLabel: "Brazil", y: 212559417},
{xLabel: "Nigeria", y: 206139589},
{xLabel: "Russia", y: 145934462},
{xLabel: "Mexico", y: 128932753}
]
}
];
/* Add the dataSeries to chart */
chart.setData(data);
chart.render();
var chartJSON = {
width: 700,
height: 250,
axesX: [{ title: 'Country' }];
axesY: [{ title: 'Population',
valueFormatRange: [1000, "K", 1000000, "M"]
}];
data: [{
plotAs: 'column',
points: [{ xLabel: "China", y: 1439323776 },
{ xLabel: "India", y: 1380004385 },
{ xLabel: "Indonesia", y: 273523615 },
{ xLabel: "Pakistan", y: 220892340 },
{ xLabel: "Brazil", y: 212559417 },
{ xLabel: "Nigeria", y: 206139589 },
{ xLabel: "Russia", y: 145934462 },
{ xLabel: "Mexico", y: 128932753 }]
}]
};
var chart = new Cosfire.Chart("chart-div", chartJSON);
chart.render();
| Data Related Properties | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| plotAs | String |
column |
|
Define the chart type of the DataSeries. |
| points | Array Cosfire.DataPoint() |
Array | [0,5,0,5] | Collection of DataPoints. |
| Link A Y-Axis With DataSeries For Multi Y-Axis Chart | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| axisYId | String |
Not Set | N/A | Link with the y axis. Chart can have multiple y-axis. 'axisYId' property in DataSeries must be set to link with a axis where "id" property was set in YAxis. |
| Data Label/Text Properties | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| labelEnabled | Boolean |
Not set | • True • False | Whether to display the label that appears near to data point drawn on the screen. |
| label | String |
Not set | The fields that can be used in the label {name}, {y}, {x}, {percentage} | Label that appears near to data point drawn on the screen. |
| labelFont | Cosfire.Font() |
Not set | --- | This property is a Font object that support all necessary attributes to apply style on data point label. |
| labelPosition | String |
Not set |
|
Position of the label that appears near to data point drawn on the screen. |
| labelAngle | Number |
Not set | Number > 0 | labelAngle property can be set to rotate the label text on DataPoint. |
| labelRotationPoint | Number |
Not set | • left • right • center | Rotation point to follow while applying labelAngle property. |
| Styling The DataPoint Or DataSeries | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| lineWidth | Number |
Example: 0.5, 1, 2 | Number > 0) | Thinness of the line series. |
| lineStyle | String |
Not set | • solid(default) • dashed • dotted | Style of the line series. |
| color | String |
Not set | Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values. | Color of the data point. If not set chart generates color for the data point automatically to make the chart look beautiful. |
| borderWidth | Number |
Not set | Number > 0 | Border width or line thickness of the data point. If not set chart generates auto value to make the chart look beautiful. |
| borderColor | String |
Not set | Supported: Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values. | Border color of the data point. If not set chart generates color for the data point automatically to make the chart look beautiful. |
| borderStyle | String |
--- | • solid(default) • dashed • dotted | Style of the border of a DataPoint. |
| markerEnabled | Boolean |
Not set | • True • False | Whether to enable the marker for DataSeries. |
| marker | Cosfire.Marker() |
Not set | --- | This property is of type Marker allows to apply style on the marker on screen that represents a DataPoint. |
| startAngle | Number |
0 | Value unit is in Degree and it may vary from 0° to 365° | Start Angle of the Pie/Doughnut. |
| innerRadius | String |
Auto Calculated In Pixel | Inner Radius of Doughnut | Inner Radius of Doughnut segment of Doughnut chart. |
| Legend: Styling The Legend-Item That Represents A Data Series | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| showInLegend | Boolean |
Not set | • True • False | Whether to display one entry for this DataSeries in the Legend or not. |
| showDataPointsInLegend | Boolean |
Not Set | • True • False | Whether to display DataPoints in Legend. |
| legendText | String |
Not Set | --- | Label/text that appears in legend. |
| legendItem | Cosfire.legendItem() |
Not Set | --- | This property is of type Chart.LegendItem(). This property can be used to set more properties to customize legend entry. LegendItem also can be represented as javascript object having all supported property by LegendItem class. |
| Properties To Format The Values. | ||||
| Property | Type | Default | Description | |
|---|---|---|---|---|
| xValueFormat | String |
Not Set | Format string to format the x automatically before displaying. Checkout the examples here: Examples | |
| xValueFormatRange | String |
Example: [1000, 'K', 1000000, 'M'] | Apply range to format the x automatically before displaying. | |
| xValueFormatFunction | Function |
Not Set | Take full power on your own hand to format x. Define custom function and attach. The function will be called automatically by the render engine. | |
| yValueFormat | String |
Not Set | Format string to format the x automatically before displaying.Checkout the examples here: Examples | |
| yValueFormatRange | String |
Not Set | Apply range to format the y automatically before displaying. Example: [1000, 'K', 1000000, 'M'] | |
| yValueFormatFunction | Function |
Not Set | Take full power on your own hand to format y. Define custom function and attach. The function will be called automatically by the render engine. | |
| zValueFormat | String |
Not Set | Format string to format the z automatically before displaying. | |
| zValueFormatRange | String |
Not Set | Apply range to format the z automatically before displaying. Example: [1000, 'K', 1000000, 'M'] | |
| zValueFormatFunction | String |
Not Set | Take full power on your own hand to format z. Define custom function and attach. The function will be called automatically by the render engine. | |
| Tooltip Related Properties. | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| tooltipText | String |
"{name}: {y}" | --- | Tooltip that appear on mouse over on data point. All properties supported under data point are supported in Tooltip text. |
| tooltipPointShape | String |
Not set | • square • triangle • circle | A Shape that appears in tooltip to represent a DataPoint or DataSeries |
| tooltipPointShape | String |
square | • square • triangle • circle | Shape that appears by default in tooltip. It automatically follows DataPoint/DataSeries color. |
| tooltipBackground | String |
white | Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values. | Background color of tooltip. |
| Interactivity Related Properties. | ||||
| Property | Type | Default | Possible Values | Description |
|---|---|---|---|---|
| selected | Boolean |
Not Set | • True • False | Mark a data-point as selected. |