问题
I am working on anychart investment portfolio dashboard
anychart investment portfolio dashboard .
How i can minimize date range of slider for one month only(on chart load) and it should be resizable.
回答1:
Use selectRange method:
You can specify given dates: http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange-plain
Specify some interval from the start or end using anchors:
http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange_set_asUnit-plain
Or use preset range types:
http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange_set_as_Type-plain
Easy sample showing this for "one month only":
chart.selectRange("MTD");
Is here: http://jsfiddle.net/97kc1jpw/
As for sample itself, we decided it is a good idea to upgrade it, use the latest version and add the option you describe right in it, along with a new nice range selector, please pull the latest changes from https://github.com/anychart-solutions/investment-portfolio-dashboard
You are interested in this particular line: Line 313 in dashboard.js
来源:https://stackoverflow.com/questions/40484376/how-to-change-slider-range-on-chart-load