I looked at this a bit on g7x.
Note the Canon histogram on g7x is one color, and it's not entirely clear what it measures. The manual says "distribution of brightness on the image" which suggests Y channel.
I initially set the CHDK histogram to linear, RGB, autoscale off.
Initially, when I tested, I would always get the warning dots, and the histogram seemed to periodically (once per second ish) show small peaks repeatedly appearing where there were none. Even turning "ignore boundary peaks" up to 32 didn't get red of the warning dots. All of these suggest the histogram is sampling something partly outside valid image data.
Looking at my screenshots, I realized I had the still aspect ratio set to 4:3. This *shouldn't* break CHDK histogram, but none of the other aspect ratios showed the same problems. So I suspect g7x has some problem viewport definitions in 4:3, even though chdkptp live view seems OK.
However, the peaks still didn't match. Switching to Y mode gives a much better match to the Canon histogram, but there are still some issues.
In the first attached image
* Top left: Flat, neutral image. Peak is in the middle of the EV chart on both, with more slop on the left. Looks correct, IMO.
* Top right: Main peak in the CHDK histo might be a little lower but could be due to resolution. Peak in the lowest EV bin definitely seems higher than the one the Canon histo.
* Bottom two: Again, lower peak in CHDK histo is shifted up a bit compared to Canon. Canon clips the main peak, but it seems like it's in the right place.
Second image:
* Left: Intentionally over exposed. CHDK histo seems to clip before it gets to the top of the top EV bin, and never shows the over warning. This is consistent with zebra needing larger (~24 Y units) margin old ports.
* Right: Same story at the low end. CHDK histo clips just after the middle of the lowest bin, warning not triggered.
The clipping behavior above is not seen on my pre-digic 6 cams. This implies that Y range actually used on D6 cams is smaller than the range used on earlier cams (already noted previously from zebra behavior)
I know this isn't the problem you reported
A few other general notes:
* CHDK histogram in playback samples the entire screen, so it will be wildly off if the image isn't displayed full screen or is letterboxed.
* CHDK histogram is affected by white balance and other Canon color effects (except maybe not much in Y mode), since it samples the the displayed YUV buffer. It doesn't sample the Canon focus peaking, since that doesn't appear in the live view buffer.
* CHDK histogram samples the whole image, theoretically accounting for letterboxing in different aspect ratios (but, this could be broken). It's not clear if the Canon histo does, but judging how it responds to changes near the edge, it probably covers most the image too.
edit:
Confirmed CHDK histogram very likely has problems if the used part of the viewport isn't 720 or 960 wide.