简体   繁体   中英

How do i achieve vertcal scrolling in amcharts

I want to achieve vertical scroll in my amcharts(stacked) as in the fiddle zoomable vertical value axis

The part of code responsible for this vertical scroll is as follows:

  "valueScrollbar": {
"autoGridCount": true,
"color": "#000000",
"scrollbarHeight": 50
},

but I am using different amchart coding pattern as depicted below:

   AmCharts.ready(function() {
                // SERIAL CHART
                chart = new AmCharts.AmSerialChart();
                chart.dataProvider = chartDataResults;
                chart.categoryField = "States";
                chart.plotAreaBorderAlpha = 0.2;

How do i achieve this functionality as there is no class for valuescrollbar. I tried this: var valueScrollbar = new AmCharts.valueScrollbar();

but AmCharts.valueScrollbar() is not valid

There is no separate value scrollbar class as it is just a ChartScrollbar object under the hood. All you have to do is assign the chart object's valueScrollbar property to an instance of ChartScrollbar or create an object similar to the JSON-style way of initialization:

//JSON-style setup:
chart.valueScrollbar = {
  "autoGridCount": true,
  "color": "#000000",
  "scrollbarHeight": 50
}

//OO setup
var valueScrollbar = new AmCharts.ChartScrollbar();
valueScrollbar.autoGridCount = true;
valueScrollbar.color = "#000000";
valueScrollbar.scrollbarHeight = 50;
chart.valueScrollbar = valueScrollbar;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM