简体   繁体   中英

Devexpress pie chart with zero values

When all the values ​​for N categories shown in a pie chart are zero, the chart is a circle with N equal sectors.

I tried using DataFilter as below, but then, nothing is shown at all (no chart, no legend information)

DataFilter dataFilter1 = new DataFilter("Amount", "System.Int32",      
    DataFilterCondition.GreaterThan, 0);
series.DataFilters.Add(dataFilter1);

Is there a way to show an empty (filled with white for example?) chart in such conditions?

you can do something like this

 // Create an empty chart.
 ChartControl pieChart = new ChartControl();

 // Create a pie series.
 Series series1 = new Series("A Pie Series", ViewType.Pie);

 // Populate the series with points.
 series1.Points.Add(new SeriesPoint("No Results found", 100));

 // Add the series to the chart.
 pieChart.Series.Add(series1);

If the data you are using to build your pie graphs are already percentiles, (computed at retrieval), pChart.Series[pData.TableName].Label = "#VALX (#VALY%)"; will do the trick

oops.. i was searching for a solution on 'Series Label (NaN)' on DataVisualization pie charts when totals are zero

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM