
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
nativescript-mpchart
Advanced tools
A NativeScript MPChart for Android and iOS. This plugin still in develop and will update more type chart and feature in future. Because I don't have much time so it only have demo-ng is detail But it can work in core. Now, a plugin have simple LineChart.
Charts for iOS
MPAndroidChart for Android
Run tns plugin add nativescript-mpchart
<color name="marker_background">#cccccc</color>
<color name="marker_text_color">#000000</color>
<color name="text_view_color">#ff0000</color>
into App_Resources/Android/values/colors.xml. SEE DETAIL IN demo-ng
Method will reset chart. Call it if some property is change but not apply in UI.
DataSetChartInterface {
x: number;
y: number;
}
DataSetLabelInterface {
xAxisValue: number,
label: string
}
DataLineChartInterface {
dataSet: Array<DataSetChartInterface>;
lineColor: Color;
highlighColor?: Color;
circleHoleEnabled?: boolean;
circleColor?: Color;
circleEnable?: boolean;
legendLabel?: string;
}
YAxisFormatterInterface {
type: TypeFormatter,
numberOfDigits?: number
}
DataBarChartInterface {
dataSet: Array<DataSetChartInterface>;
legendLabel?: string;
highlighColor?: Color,
barColor?: Color;
}
ChartMarkerSize {
width: number,
height: number
}
ChartMarkerPadding {
top: number;
right: number;
bottom: number;
left: number;
}
ConfigDisplayData {
showXValue: boolean,
showYValue: boolean,
fixedXValue?: YAxisFormatterInterface,
fixedYValue?: YAxisFormatterInterface,
formatter: string;
}
ChartMarkerConfig {
backgroundColor?: Color,
textColor?: Color,
font?: string,
fontSize?: number,
padding?: {
x: number,
y: number
},
minimumSize?: ChartMarkerSize,
borderRadius?: number,
contentCenter?: boolean,
displayData: ConfigDisplayData,
xOffset?: number,
yOffset?: number,
}
NativeScriptMPLineChartModule in NgModule:import { NativeScriptMPLineChartModule } from "nativescript-mpchart/angular";
//......
@NgModule({
//......
imports: [
//......
NativeScriptMPLineChartModule,
//......
],
//......
})
height="100%"
to full in parent layout.
<!-- app.component.html -->
<!-- line chart -->
<StackLayout height="500">
<MPLineChart *ngIf="dataSet" #lineChart [showLegend]="setUp.showLegend" [showGridLines]="setUp.showGridLines" [scaleEnable]="setUp.scaleEnable"
[descriptionText]="setUp.descriptionText" [descriptionXOffset]="setUp.descriptionXOffset" [descriptionYOffset]="setUp.descriptionYOffset"
[descriptionTextColor]="setUp.descriptionTextColor" [highlightPerTapEnabled]="setUp.highlightPerTapEnabled" [highlightPerDragEnabled]="setUp.highlightPerDragEnabled"
[xAxisGranularity]="setUp.xAxisGranularityProperty" [leftAxisGranularity]="setUp.leftAxisGranularityProperty" [rightAxisGranularity]="setUp.rightAxisGranularityProperty"
[xAxisLineColor]="setUp.xAxisLineColor" [leftAxisLineColor]="setUp.leftAxisLineColor" [rightAxisLineColor]="setUp.rightAxisLineColor"
[xAxisTextColor]="setUp.xAxisTextColor" [leftAxisTextColor]="setUp.leftAxisTextColor" [rightAxisTextColor]="setUp.rightAxisTextColor"
[xAxisMinValue]="setUp.xAxisMinValue" [leftAxisMinValue]="setUp.leftAxisMinValue" [rightAxisMinValue]="setUp.rightAxisMinValue"
[leftAxisMaxValue]="setUp.leftAxisMaxValue" [rightAxisMaxValue]="setUp.rightAxisMaxValue" [xAxisLabelPosition]="setUp.xAxisLabelPosition"
[leftAxisFormatter]="leftAxisFormatter" [rightAxisFormatter]="rightAxisFormatter" [items]="dataSet" [labels]="labels"
[font]="setUp.font" class="mp-chart"></MPLineChart>
</StackLayout>
<!-- bar chart -->
<StackLayout height="500">
<MPBarChart height="400" #lineChart *ngIf="barDataSet" [items]="barDataSet" [labels]="labels" [showLegend]="setUp.showLegend"
[showGridLines]="setUp.showGridLines" [scaleEnable]="setUp.scaleEnable" [descriptionText]="setUp.descriptionText"
[descriptionXOffset]="setUp.descriptionXOffset" [descriptionYOffset]="setUp.descriptionYOffset" [descriptionTextColor]="setUp.descriptionTextColor"
[xAxisGranularity]="setUp.xAxisGranularityProperty" [leftAxisGranularity]="setUp.leftAxisGranularityProperty" [rightAxisGranularity]="setUp.rightAxisGranularityProperty"
[xAxisLineColor]="setUp.xAxisLineColor" [leftAxisLineColor]="setUp.leftAxisLineColor" [rightAxisLineColor]="setUp.rightAxisLineColor"
[xAxisTextColor]="setUp.xAxisTextColor" [leftAxisTextColor]="setUp.leftAxisTextColor" [rightAxisTextColor]="setUp.rightAxisTextColor"
[xAxisMinValue]="setUp.xAxisMinValue" [leftAxisMinValue]="setUp.leftAxisMinValue" [rightAxisMinValue]="setUp.rightAxisMinValue"
[leftAxisMaxValue]="setUp.leftAxisMaxValue" [rightAxisMaxValue]="setUp.rightAxisMaxValue" [xAxisLabelPosition]="setUp.xAxisLabelPosition"
[leftAxisFormatter]="leftAxisFormatter" [rightAxisFormatter]="rightAxisFormatter" [font]="setUp.font"
[showValueLabels]="setUp.showValueLabels" [showLeftAxis]="setUp.showLeftAxis" [showRightAxis]="setUp.showRightAxis"
[marker]="markerConfig" class="mp-chart"></MPBarChart>
</StackLayout>
/*app.css*/
.mp-chart {
description-text-color: #00ff00;
x-axis-line-color: #ff0000;
left-axis-line-color: #005500;
right-axis-line-color: #ff00ff;
x-axis-text-color: #ff0000;
left-axis-text-color: #005500;
right-axis-text-color: #ff00ff;
}
// app.component.ts
import { Component } from "@angular/core";
import { DataLineChartInterface, DataSetChartInterface, DataSetLabelInterface,YAxisFormatterInterface } from "nativescript-mpchart";
@Component({
selector: "ns-app",
templateUrl: "app.component.html",
})
export class AppComponent {
public setUp: any = {
showGridLines: false,
showLegend: true,
scaleEnable: true,
descriptionText: "Text for chart",
descriptionXOffset: 0,
descriptionYOffset: 0,
descriptionTextColor: "#ffff00",
highlightPerTapEnabled: true,
highlightPerDragEnabled: true,
xAxisGranularityProperty: 1,
leftAxisGranularityProperty: 20,
rightAxisGranularityProperty: 30,
xAxisLineColor: "#ff0000",
xAxisTextColor: "#ff0000",
leftAxisLineColor: "#0000ff",
leftAxisTextColor: "#0000ff",
rightAxisLineColor: "#00ff00",
rightAxisTextColor: "#00ff00",
xAxisMinValue: -1,
xAxisMaxValue: 4,
leftAxisMinValue: 0,
leftAxisMaxValue: 100,
rightAxisMinValue: 0,
rightAxisMaxValue: 70,
font: "Papyrus",
xAxisLabelPosition: "Bottom",
showValueLabels: false,
showLeftAxis: true,
showRightAxis: false,
};
public leftAxisFormatter: YAxisFormatterInterface = {
type: "Float",
numberOfDigits: 1
};
public rightAxisFormatter: YAxisFormatterInterface = {
type: "Float",
numberOfDigits: 1
};
public markerConfig: ChartMarkerConfig
public dataSet: Array<DataLineChartInterface>;
public barDataSet: Array<DataBarChartInterface>;
public labels: Array<DataSetLabelInterface>;
constructor(
public changeDetectorRef: ChangeDetectorRef
) {
let cyan = new Color("#00FFFF");
let color = new Color("#FF0000");
let color1 = new Color("#00FF00");
let arrDataView1: Array<DataSetChartInterface> = [];
let arrDataView2: Array<DataSetChartInterface> = [];
let arrLabel: Array<DataSetLabelInterface> = [];
let arrDataView: Array<DataSetChartInterface> = [];
for (let i = 0; i < 8; i++) {
arrDataView1.push({
x: i,
y: i * 9,
});
arrDataView2.push({
x: i,
y: i + 30,
});
arrLabel.push({
xAxisValue: i,
label: `Tháng ` + (i + 1)
})
}
let item: DataLineChartInterface = {
dataSet: arrDataView1,
lineColor: cyan,
highlighColor: color,
legendLabel: "arrDataView1"
};
let item1: DataLineChartInterface = {
dataSet: arrDataView2,
lineColor: color1,
highlighColor: color,
};
this.dataSet = [];
this.dataSet.push(item);
this.dataSet.push(item1);
this.barDataSet = [];
this.barDataSet.push({
dataSet: arrDataView1,
legendLabel: "barChartView1",
highlighColor: color,
barColor: color1
});
this.markerConfig = {
displayData: {
showXValue: false,
showYValue: true,
formatter: "Yvalue: {{y}}",
},
contentCenter: true,
xOffset: -30,
yOffset: -30,
backgroundColor: new Color("#0000ff"),
textColor: new Color("#ffffff"),
font: "Papyrus",
fontSize: 12,
padding: {
x: 20,
y: 10
}
}
this.labels = arrLabel;
}
}
##FixSameError
When use plugin if you see error when build --aot in line import interface in file .component like this :
Module not found. Can't resolve "nativescript-mpchart" in "relative path*.component".
You can't try change to : import { ... } from "nativescript-mpchart/index" and delete all platform, hook, node_modules and rebuild. I think an error in platform and angular not in plugin because i see it when develop.
This repository includes both Angular and plain NativeScript demos. In order to run those execute the following in your shell:
$ git clone https://github.com/LeCaoPhuc/nativescript-mpchart
$ cd nativescript-mpchart/src
$ npm install
$ npm run demo
This will run the plain NativeScript demo project on iOS. If you want to run it on Android simply use the .android instead of the .ios sufix.
If you want to run the Angular demo simply use the demo.ios.ng.
FAQs
NativeScript MPChart
We found that nativescript-mpchart demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.