c# - MS Chart axes are drawn trough data points -


i'm working ms charts, , somehow can't figure out way draw points on top of y-axis. can see in image below, points @ x = 0 (label 1998) below y-axis. recognize problem? has order of prepaint , postpaint events?

axis trough points

edit: test custom drawn dots, until y-axis.. enter image description here

in chart datapoints go over gridlines under axes , tickmarks.

to paint them over axes need owner draw them in 1 of paint events.

this simple if charttype of type points, spline or line , markertype of circle or rectangle.

for other types column or bar etc lot harder.

here simple example points; pick size better..!

private void chart1_postpaint(object sender, chartpainteventargs e) {     if (chart1.series.count == 0) return;      axis ax = chart1.chartareas[0].axisx;     axis ay = chart1.chartareas[0].axisy;     chart1.applypalettecolors();     foreach (series s in chart1.series)         foreach (datapoint dp in s.points)         {            float x = (float )ax.valuetopixelposition(dp.xvalue);            float y = (float )ay.valuetopixelposition(dp.yvalues[0]);            float w2 = 3.6f;            using (solidbrush brush = new solidbrush(color.yellowgreen))                   e.chartgraphics.graphics.fillellipse(brush,                                                         x - w2, y - w2, w2 * 2f, w2 * 2f);         } } 

enter image description hereenter image description here

i have suppressed custom drawing some points.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -