, ZingChart.
Angular, zcRender. . 1.2.1 github npm. plnkr, .
$scope.$watch('zcRender', function(newValue, oldValue, scope) {
if(initializing.render){
initializing.render = !initializing.render;
return;
}
zingchart.exec(scope.id, 'destroy');
scope.zcRender = newValue;
scope.renderChart();
},true);
$scope.renderChart = function (){
var id = $element.attr('id');
var _json = {
data : {
type : 'line',
series : []
},
width : 600,
height: 400
};
if($scope.zcRender){
mergeObject($scope.zcRender, _json);
}
if($scope.zcJson){
mergeObject($scope.zcJson, _json.data);
}
if($scope.zcValues){
injectValues($scope.zcValues, _json.data);
}
_json.data.type = ($attrs.zcType) ? $attrs.zcType : _json.data.type;
_json.height = ($attrs.zcHeight) ? $attrs.zcHeight : _json.height;
_json.width = ($attrs.zcWidth) ? $attrs.zcWidth : _json.width;
_json.id = id;
if(_json.width === "100%" && !$element.css('width')){
$element.css('width', '100%');
}
if(_json.height === "100%" && !$element.css('height')){
$element.css('height', '100%');
}
zingchart.render(_json);
}