Open insinfo opened 5 years ago
The package is using js_interop, so you need to wrap your function with allowInterop
from package:js
=> https://pub.dev/packages/js
tooltipOptions.contents = allowInterop((dynamic d, String defaultTitleFormat,
String defaultValueFormat, dynamic color) {
...
});
@lejard-h I wrap the function with "allowInterop" and then I started getting another error, in the following part
var name = d[i]?.name;
var value = d[i]?.value;
var titleIn = d[i]?.x;
bgcolor = color(d[i]?.id);
I could not access the properties of the native javascript object
weird I have no issue doing that :/
can you try without the operator ?
@lejard-h I wrap the function with "allowInterop" and then I started getting another error, in the following part
var name = d[i]?.name;
var value = d[i]?.value;
var titleIn = d[i]?.x;
bgcolor = color(d[i]?.id);
I could not access the properties of the native javascript object .
My temporary solution was this, does anyone know a better solution. dart
@JS('getObjInstancePropertyValue')
external dynamic getObjInstancePropertyValue(jsObject,key);
js
function getObjInstancePropertyValue(objInstance, key) {
try {
return objInstance[key];
}
catch (err) {
print('getObjInstancePropertyValue');
return null;
}
}
name = getObjInstancePropertyValue(selectedData[i], 'name');
value = getObjInstancePropertyValue(selectedData[i], 'value');
titleIn = getObjInstancePropertyValue(selectedData[i], 'x');
The strange thing is that everything works perfectly in DDC
I can't format or modify Tooltipe HTML because of this issue.
I am having this problem, I am using the c3js library to draw charts, when I am developing my AngularDart app with "webdev serve" (DDC) everything is ok, but when I compile for production with webdev build (dart2js) the application crashes with excepprion " Uncaught TypeError: o.tooltip_contents.call is not a function "
https://pub.dev/packages/c3