try to support both histogram and dotplot