{"action":"created","issue":{"url":"https://api.github.com/repos/oxyplot/oxyplot/issues/442","labels_url":"https://api.github.com/repos/oxyplot/oxyplot/issues/442/labels{/name}","comments_url":"https://api.github.com/repos/oxyplot/oxyplot/issues/442/comments","events_url":"https://api.github.com/repos/oxyplot/oxyplot/issues/442/events","html_url":"https://github.com/oxyplot/oxyplot/issues/442","id":67006900,"number":442,"title":"Consistency issues with ViewMaximum and ActualMaximum","user":{"login":"stefan-schweiger","id":3532342,"avatar_url":"https://avatars.githubusercontent.com/u/3532342?v=3","gravatar_id":"","url":"https://api.github.com/users/stefan-schweiger","html_url":"https://github.com/stefan-schweiger","followers_url":"https://api.github.com/users/stefan-schweiger/followers","following_url":"https://api.github.com/users/stefan-schweiger/following{/other_user}","gists_url":"https://api.github.com/users/stefan-schweiger/gists{/gist_id}","starred_url":"https://api.github.com/users/stefan-schweiger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefan-schweiger/subscriptions","organizations_url":"https://api.github.com/users/stefan-schweiger/orgs","repos_url":"https://api.github.com/users/stefan-schweiger/repos","events_url":"https://api.github.com/users/stefan-schweiger/events{/privacy}","received_events_url":"https://api.github.com/users/stefan-schweiger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/oxyplot/oxyplot/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/oxyplot/oxyplot/labels/help-wanted","name":"help-wanted","color":"000000"},{"url":"https://api.github.com/repos/oxyplot/oxyplot/labels/hold","name":"hold","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-07T22:47:23Z","updated_at":"2015-04-08T22:12:51Z","closed_at":null,"body":"Currently `ActualMaximum` is composed of either `ViewMaximum`, `Maximum` or the *calculated* maximum if the other two are not set. And `ViewMaximum` just gets used when the view gets panned or zoomed (but also has a public setter (why?))\r\n\r\n```c#\r\ninternal virtual void UpdateActualMaxMin()\r\n{\r\n    if (!double.IsNaN(this.ViewMaximum))\r\n    {\r\n        // The user has zoomed/panned the axis, use the ViewMaximum value.\r\n        this.ActualMaximum = this.ViewMaximum;\r\n    }\r\n    else if (!double.IsNaN(this.Maximum))\r\n    {\r\n        // The Maximum value has been set\r\n        this.ActualMaximum = this.Maximum;\r\n    }\r\n    else\r\n    {\r\n        // Calculate the actual maximum, including padding\r\n        this.ActualMaximum = this.CalculateActualMaximum();\r\n    }\r\n\r\n    ...\r\n\r\n    this.CoerceActualMaxMin();\r\n}\r\n```\r\n\r\nIn my opinion `ActualMaximum` should be the actual *calculated* data maximum (+ padding) and `ViewMaximum` the currently *displayed* maximum in the view (and should not have a public setter as it just makes no sense to allow this).\r\n\r\nThe only two properties with public setters of this kind should be `AbsoluteMaximum` (which should be the maximum value for `ViewMaximum` if set) and `Maximum` (which should be the default value for `ViewMaximum` if set).\r\n\r\n```c#\r\n/* This maybe only setting the backing fields in calculation methods\r\n   instead of doing this in the getter is a more suitable way to do this,\r\n   but anyways this is what it could look like.\r\n*/\r\nprivate double viewMaximum;\r\n\r\npublic double ViewMaximum\r\n{\r\n    get {\r\n       // if an absolute maximum is set and it's smaller than viewMaximum return AbsoluteMaximum\r\n       if (AbsoluteMaximum < viewMaximum)\r\n           return AbsoluteMaximum;\r\n\r\n        // if viewMaximum is not set (no zoom or pan) return Maximum\r\n        return double.IsNaN(viewMaximum) ? Maximum : viewMaximum;\r\n    }\r\n    protected set { viewMaximum = value; }\r\n}\r\n\r\npublic double ActualMaximum\r\n{\r\n    get {\r\n        return this.CalculateActualMaximum();\r\n    }\r\n}\r\n```\r\n\r\nI guess this are just my two cents as it would maybe involve breaking changes for some people (I say maybe because any externally set value for `ViewMaximum` would be replaced pretty fast by the calculated one anyways, the same goes for `AbsoluteMaximum`).\r\n\r\nBut I want to hear others opinions on this issue, or if there are good reasons for the current implementation I just don't see."},"comment":{"url":"https://api.github.com/repos/oxyplot/oxyplot/issues/comments/91051743","html_url":"https://github.com/oxyplot/oxyplot/issues/442#issuecomment-91051743","issue_url":"https://api.github.com/repos/oxyplot/oxyplot/issues/442","id":91051743,"user":{"login":"objorke","id":439716,"avatar_url":"https://avatars.githubusercontent.com/u/439716?v=3","gravatar_id":"","url":"https://api.github.com/users/objorke","html_url":"https://github.com/objorke","followers_url":"https://api.github.com/users/objorke/followers","following_url":"https://api.github.com/users/objorke/following{/other_user}","gists_url":"https://api.github.com/users/objorke/gists{/gist_id}","starred_url":"https://api.github.com/users/objorke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objorke/subscriptions","organizations_url":"https://api.github.com/users/objorke/orgs","repos_url":"https://api.github.com/users/objorke/repos","events_url":"https://api.github.com/users/objorke/events{/privacy}","received_events_url":"https://api.github.com/users/objorke/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T22:12:51Z","updated_at":"2015-04-08T22:12:51Z","body":"More thoughts about ViewMaximum/ViewMinimum: \r\n- it might be ok to keep the setters public as long as it is well described how they work. Maybe someone want to set the initial ViewMinimum/ViewMaximum programatically and also specify Minimum/Maximum at the same time\r\n- or make them completely private/internal if this feature is not really needed\r\n\r\nSorry for the confusion regarding this design - I am not yet sure what is the best solution... \r\nNeed some good arguments if this should be changed..."}}