{"action":"created","issue":{"url":"https://api.github.com/repos/ocornut/imgui/issues/342","labels_url":"https://api.github.com/repos/ocornut/imgui/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/ocornut/imgui/issues/342/comments","events_url":"https://api.github.com/repos/ocornut/imgui/issues/342/events","html_url":"https://github.com/ocornut/imgui/pull/342","id":107351288,"number":342,"title":"fixed rendering of histogram with a lot of values","user":{"login":"nem0","id":153526,"avatar_url":"https://avatars.githubusercontent.com/u/153526?v=3","gravatar_id":"","url":"https://api.github.com/users/nem0","html_url":"https://github.com/nem0","followers_url":"https://api.github.com/users/nem0/followers","following_url":"https://api.github.com/users/nem0/following{/other_user}","gists_url":"https://api.github.com/users/nem0/gists{/gist_id}","starred_url":"https://api.github.com/users/nem0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nem0/subscriptions","organizations_url":"https://api.github.com/users/nem0/orgs","repos_url":"https://api.github.com/users/nem0/repos","events_url":"https://api.github.com/users/nem0/events{/privacy}","received_events_url":"https://api.github.com/users/nem0/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-19T19:13:26Z","updated_at":"2015-09-20T10:02:53Z","closed_at":"2015-09-20T09:26:14Z","pull_request":{"url":"https://api.github.com/repos/ocornut/imgui/pulls/342","html_url":"https://github.com/ocornut/imgui/pull/342","diff_url":"https://github.com/ocornut/imgui/pull/342.diff","patch_url":"https://github.com/ocornut/imgui/pull/342.patch"},"body":"When I draw a histogram with many elements (40+ on my computer), some values are rendered twice and some are skipped. It is caused by this code in ImGui::PlotEx:\r\n\r\n```cpp\r\n    ...\r\n    for (int n = 0; n < res_w; n++)\r\n    {\r\n        const float t1 = t0 + t_step;\r\n        const int v_idx = (int)(t0 * values_count);\r\n    ...\r\n```\r\n\r\nProblem is the int cast. \r\n\r\nn == 23 -> t0 * values_count == 23.0000019 -> v_idx == 23\r\nn == 24 -> t0 * values_count == 23.9999987 -> v_idx == 23\r\n"},"comment":{"url":"https://api.github.com/repos/ocornut/imgui/issues/comments/141769417","html_url":"https://github.com/ocornut/imgui/pull/342#issuecomment-141769417","issue_url":"https://api.github.com/repos/ocornut/imgui/issues/342","id":141769417,"user":{"login":"ocornut","id":8225057,"avatar_url":"https://avatars.githubusercontent.com/u/8225057?v=3","gravatar_id":"","url":"https://api.github.com/users/ocornut","html_url":"https://github.com/ocornut","followers_url":"https://api.github.com/users/ocornut/followers","following_url":"https://api.github.com/users/ocornut/following{/other_user}","gists_url":"https://api.github.com/users/ocornut/gists{/gist_id}","starred_url":"https://api.github.com/users/ocornut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocornut/subscriptions","organizations_url":"https://api.github.com/users/ocornut/orgs","repos_url":"https://api.github.com/users/ocornut/repos","events_url":"https://api.github.com/users/ocornut/events{/privacy}","received_events_url":"https://api.github.com/users/ocornut/received_events","type":"User","site_admin":false},"created_at":"2015-09-20T10:02:53Z","updated_at":"2015-09-20T10:02:53Z","body":"Also improved rendering for histogram with lots of values.\r\n\r\n![plot](https://cloud.githubusercontent.com/assets/8225057/9980195/78a771de-5f8f-11e5-840d-da25bb09eabd.gif)\r\n"}}