Saturday, 15 June 2013

c# - MS Chart color and legends in Winforms -



c# - MS Chart color and legends in Winforms -

i utilize microsoft chart in 1 of forms. selected pie chart.

then, in runtime, assign values , legends need this:

{ double[] yvalues = { valor_pendiente, valor_gest_judicial, valor_cancelado }; string[] xnames = { "pendientes", "gest. judic.", "cancelado" }; chart1.series[0].points.databindxy(xnames, yvalues); color[] colores = new color[] { barra_azul, color.orange, color.limegreen }; chart1.palettecustomcolors = colores; }

ok, have 2 questions:

1: there way hide legends when value little or zero? because graphically, not ok.

gest. judic. not have value there , stills shows.

is there other way show legends?

1st issue has been solved

also, sec question:

can utilize gradients instead of colors (instead of using array of colors)? if can, how can it?

the series class lets set backgradientstyle gradient direction. set backsecondarycolor alter fade-in color of gradient.

chart1.series[0].backgradientstyle = gradientstyle.diagonalright; chart1.series[0].backsecondarycolor = color.cyan;

you can set gradient each datapoint in chart give them each custom gradient:

chart1.series[0].points[0].backgradientstyle = gradientstyle.diagonalright; chart1.series[0].points[0].color = color.red; chart1.series[0].points[0].backsecondarycolor = color.brown;

note doesn't work if have 3d effect enabled, must turned off.

chart1.chartareas[0].area3dstyle.enable3d = false;

c# winforms charts

No comments:

Post a Comment