Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fading in amcharts (startAlpha without startEffect)

I am trying to get charts to fade in without having them bounce in, or come in elastically, etc.

From the docs, it says that elastic is the default animation type. I tried blank, or "none". Those crash amcharts.

See the following fiddle: https://jsfiddle.net/tegnu71s/

var chart = AmCharts.makeChart( "chartdiv", {
"type": "pie",
"theme": "light",
 startDuration:"10",
 startEffect:"elastic",
 startAlpha:0,
"dataProvider": [ {
"country": "Lithuania",
"litres": 501.9
 }, {
"country": "Czech Republic",
"litres": 301.9
} ],
"valueField": "litres",
"titleField": "country",
 "balloon":{
 "fixedPosition":true
},
"export": {
  "enabled": true
}
} );

Is this possible, and if so, how?

like image 402
juacala Avatar asked Feb 11 '26 06:02

juacala


1 Answers

You have correctly identified the startAlpha parameter. It will make the slices fade in.

Now, to just disable the bounce effect, set startRadius to zero:

var chart = AmCharts.makeChart("chartdiv", {
  "type": "pie",
  "theme": "light",
  "startDuration": 10,
  "startRadius": 0,
  "startAlpha": 0,
  "dataProvider": [{
    "country": "Lithuania",
    "litres": 501.9
  }, {
    "country": "Czech Republic",
    "litres": 301.9
  }],
  "valueField": "litres",
  "titleField": "country",
  "balloon": {
    "fixedPosition": true
  },
  "export": {
    "enabled": true
  }
});
<script src="//www.amcharts.com/lib/3/amcharts.js"></script>
<script src="//www.amcharts.com/lib/3/pie.js"></script>
<script src="//www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv" style="width: 100%; height: 250px;"></div>

If you want the slices fade in all at once as opposed to one by one, set sequencedAnimation: true

like image 185
martynasma Avatar answered Feb 17 '26 19:02

martynasma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!