Highcharts: generate blank chart -


my application takes in dynamic data , generates chart, option display message overlayed on top using chart.renderer.text().

sometimes dynamic request data malformed, , resultant data unreliable, in case i'd generate blank chart (with custom background colour) of same width , height requested (that part of request ok), , message overlay described above display message user.

what easiest way of doing that? want blank chart literally that... solid colour no axes or anything, , no message "no data display" i've seen on couple of examples found when searching answer. , on top of blank background (with user-defined width , height) message overlay.

it easiest create... empty chart. in load event add necessary text chart. this: http://jsfiddle.net/zkj36o7e/1/

$('#container').highcharts({     chart: {         events: {             load: function () {                 var text = this.renderer.text("malformed data").attr({                     'text-anchor': "middle",                 // svg's text-align ;)                     stroke: "black",                         // color                     opacity: 0,                              // smooth animation - part                       x: this.plotwidth / 2 + this.plotleft    // x-center of plot                 }).add(),                     bbox = text.getbbox();                   // bounding box of created text                   text.attr({                     y: this.plotheight / 2 - bbox.height / 2 // y-position - half of text's height                 }).animate({                     opacity: 1                               // smooth animation - part ii                 });             }         }     } }); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -