Set chart minimum and maximum axes values ignored
-
Hi all ,
Having problems with fixing the maximum and minimum range for my graph. I do not want to show below zero as a value as the y-axis is supposed to represent a percentage.<md-card flex> <md-card-content ng-controller="flAPI"> <ma-point-query query="'or(and(like(deviceName,*Grain Silo*),eq(name,Grain Level)),and(like(deviceName,*Molasses Silo*),like(name,Molasses Level)))&sort(deviceName,name)'" points="devices"></ma-point-query> <ma-point-values points="devices" values="combined" from="from" to="to"></ma-point-values> <ma-serial-chart id="flChart" style="height: 500px; width: 100%" points="devices" values="combined" options="{valueAxes:[{ minimum:0, maximum:100,title:'Feed Level (%)'}]}" legend="true" balloon="true"></ma-serial-chart> <ma-date-range-picker from="from" to="to" preset="LAST_1_WEEKS" update-interval="15 minutes" on-change="$ctrl.timeUpdated(from, to, preset)"></ma-date-range-picker> <md-input-container flex> <label>From date</label> <ma-date-picker ng-model="from"></ma-date-picker> </md-input-container> <md-input-container flex> <label>To date</label> <ma-date-picker ng-model="to"></ma-date-picker> </md-input-container> </md-card-content> </md-card>
As far as I know, this is correct and follows a lot of what your examples do. Yet the graph still comes up showing -10 and + 90. Some assistance would be greatly appreciated...
I realise that some values go below zero but I'd rather not show this as they make no sense in this instance.
Thanks
Matt -
Hey Matt,
Took me a while to figure this out but we have
synchronizeGrid
turned on in the AmCharts options. Its documented here https://www.amcharts.com/demos/multiple-value-axes/Try changing your options to
options="{synchronizeGrid: false, valueAxes:[{ minimum:0, maximum:100,title:'Feed Level (%)'}]}"
Note that there are various other ValueAxis options that may affect the minimum and maximum. So take a look at https://docs.amcharts.com/3/javascriptcharts/ValueAxis if you have any issues.
Jared
-
Gent!
That did it beautifully, A bit relieved I'm not the only one it stumped momentarily. Feel a bit of a muppet though not seeing that bit in their docs...
Thanks Jared! -
@MattFox No worries! Its mentioned on one of their demo pages but not in the API docs which is what made it difficult to figure out.
-
I sent AMCharts an email letting them know that property might not be documented fully.
-
Their reply,
Hi Phillip,
Thanks for pointing this out. This property was originally documented on our site and listed as a beta/experimental feature (and it still is), but we removed references to it in the documentation because it was not quite ready for primetime as it worked in very basic use cases (note that it will ignore any user set minimum and maximum values). As we're currently focusing on our next major version, we don't have an ETA as to when we'll iron out any remaining issues with synchronizeGrid. You're more than welcome to keep using it if it works for you, but use at your own risk.
As for enforcing the minimums and maximums, setting the value axis' strictMinMax (http://docs.amcharts.com/3/javascriptcharts/ValueAxis#strictMinMax) property to true should do the trick.
Please let me know if you have any questions.
Best,
[Name of AMChart support person] -
@phildunlap Many thanks, at least we all know now and if anyone hits this snag they'll find it here.
Matt