Can't bind chart-data from component to view. Angular 6, predix-ui


Can't bind chart-data from component to view. Angular 6, predix-ui



pls help. SOS



I'm trying to bind chart-data to plot graph, like:


[attr.chart-data]='chartData'



But in console of browser I have only warning that:



Polymer::Attributes: couldn`t decode Array as JSON



My Component:


export class AppComponent {
arr: Array<Object> = ;
seriesConfig: {};

ngOnInit(): void {
this.arr = [
{ x: 1530426560000, y: 179.46 },
{ x: 1530426570000, y: 179.58 },
{ x: 1530426580000, y: 179.58 },
{ x: 1530426590000, y: 179.6 },
{ x: 1530426600000, y: 179.52 },
{ x: 1530426610000, y: 179.56 },
{ x: 1530426620000, y: 179.52 },
{ x: 1530426630000, y: 179.52 }
];

this.seriesConfig = {
y: { type: "line", name: "series1", x: "x", y: "y" }
};
} }



My View:


<div>
<h2 id="title-tag">Timeseries</h2>
<px-vis-timeseries id="ts1" prevent-resize width="950" height="500" register-location="side" enable-tooltip="true" tooltip
include-all-series selection-type="x" [attr.chart-data]='arr' [attr.series-config]='seriesConfig' x-axis-config='{"title": "Date"}'
y-axis-config='{"title": "y1"}'>
</px-vis-timeseries>





Questions:



Thanks in advance!




1 Answer
1



I think you need to pass the chart data with a camelCase key, rather than dashes. (This is the way Polymer works.) Something like this:


<px-vis-timeseries [chartData]='arr'></px-vis-timeseries>



Some more info & links here:
https://www.predix-ui.com/#/develop/frameworks-angular





Yes, I've tried it, but in this way it doesn't work too. No warnings, no errors, only empty graph appears without any lines. Any suggestions, why so?
– Galym
Jul 2 at 19:53







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages