{"action":"created","issue":{"url":"https://api.github.com/repos/highcharts/highcharts/issues/5988","repository_url":"https://api.github.com/repos/highcharts/highcharts","labels_url":"https://api.github.com/repos/highcharts/highcharts/issues/5988/labels{/name}","comments_url":"https://api.github.com/repos/highcharts/highcharts/issues/5988/comments","events_url":"https://api.github.com/repos/highcharts/highcharts/issues/5988/events","html_url":"https://github.com/highcharts/highcharts/issues/5988","id":189867902,"number":5988,"title":"The chart.update function does not handle colors appropriately","user":{"login":"aazhari","id":7737331,"avatar_url":"https://avatars.githubusercontent.com/u/7737331?v=3","gravatar_id":"","url":"https://api.github.com/users/aazhari","html_url":"https://github.com/aazhari","followers_url":"https://api.github.com/users/aazhari/followers","following_url":"https://api.github.com/users/aazhari/following{/other_user}","gists_url":"https://api.github.com/users/aazhari/gists{/gist_id}","starred_url":"https://api.github.com/users/aazhari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aazhari/subscriptions","organizations_url":"https://api.github.com/users/aazhari/orgs","repos_url":"https://api.github.com/users/aazhari/repos","events_url":"https://api.github.com/users/aazhari/events{/privacy}","received_events_url":"https://api.github.com/users/aazhari/received_events","type":"User","site_admin":false},"labels":[{"id":56034,"url":"https://api.github.com/repos/highcharts/highcharts/labels/Bug","name":"Bug","color":"fa0000","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-16T22:26:58Z","updated_at":"2016-11-21T13:39:33Z","closed_at":null,"body":"#### Expected behaviour\r\nAfter creating a new chart with a specific color array specified:\r\n```\r\n  var chart = Highcharts.chart('container', {\r\n    colors: [\"red\", \"blue\", \"green\", \"purple\", \"gray\"],\r\n    series: [{\r\n      name: 'Tokyo',\r\n      data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]\r\n    }\r\n    ....\r\n}\r\n```\r\n![image](https://cloud.githubusercontent.com/assets/7737331/20368432/913b30e6-ac19-11e6-8374-9c2e13a41840.png)\r\nAfter updating the color property using chart.update:\r\n```\r\nchart.update({\r\n    colors: [\"orange\", \"violet\", \"indigo\"]\r\n})\r\n\r\n```\r\nThe chart should look how it does when initially drawing it with those colors:\r\n![image](https://cloud.githubusercontent.com/assets/7737331/20368308/172e4964-ac19-11e6-8722-164e76269f38.png)\r\n\r\n#### Actual behaviour\r\nAfter calling:\r\nchart.update({\r\n    colors: [\"orange\", \"violet\", \"indigo\"]\r\n})\r\nIf not as many colors are specified, they don't roll over resulting in hidden series:\r\n![image](https://cloud.githubusercontent.com/assets/7737331/20368344/3c948164-ac19-11e6-8c06-f2727cd884d0.png)\r\n\r\n#### Live demo with steps to reproduce\r\n[Link to jsfiddle](https://jsfiddle.net/a3bge3fL/2/)\r\n\r\n\r\n#### Affected browser(s)\r\nAll browsers\r\n"},"comment":{"url":"https://api.github.com/repos/highcharts/highcharts/issues/comments/261940875","html_url":"https://github.com/highcharts/highcharts/issues/5988#issuecomment-261940875","issue_url":"https://api.github.com/repos/highcharts/highcharts/issues/5988","id":261940875,"user":{"login":"TorsteinHonsi","id":227836,"avatar_url":"https://avatars.githubusercontent.com/u/227836?v=3","gravatar_id":"","url":"https://api.github.com/users/TorsteinHonsi","html_url":"https://github.com/TorsteinHonsi","followers_url":"https://api.github.com/users/TorsteinHonsi/followers","following_url":"https://api.github.com/users/TorsteinHonsi/following{/other_user}","gists_url":"https://api.github.com/users/TorsteinHonsi/gists{/gist_id}","starred_url":"https://api.github.com/users/TorsteinHonsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TorsteinHonsi/subscriptions","organizations_url":"https://api.github.com/users/TorsteinHonsi/orgs","repos_url":"https://api.github.com/users/TorsteinHonsi/repos","events_url":"https://api.github.com/users/TorsteinHonsi/events{/privacy}","received_events_url":"https://api.github.com/users/TorsteinHonsi/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T13:39:33Z","updated_at":"2016-11-21T13:39:33Z","body":"The bug is that `series.userOptions._colorIndex` is cached on the first run, and since the length of the color array is changed, the index now points to non-existing colors.\r\n\r\nThe workaround is to set equal length colors."}}
{"actor":{"display_login":"TorsteinHonsi"}}