xaml - WPF Pie chart doesn't slice up -
i using piechart
control display 2 values database (used , available). output without slicing seen in image below,
how slice pie chart?
my keyvalue pair of type . getting values keyvaluepair datasource & retrieving using linq sql queries.
xaml pie chart:
<window.resources> <collectionviewsource x:key="ramview" source="{binding path=usagerams, source={staticresource serverview}}"/> </window.resources> <dvc:chart x:name="ram" background="white" foreground="black" margin="950,0,92,485" grid.column="1" grid.row="1"> <dvc:chart.series> <dvc:pieseries itemssource="{binding}" dependentvaluepath="available" independentvaluepath="used" > </dvc:pieseries> </dvc:chart.series> </dvc:chart>
code behind
private collectionviewsource serversusageramsviewsource; private void window_loaded(object sender, routedeventargs e) { var ramlist = (from c in db.usagerams orderby c.usageramid descending, c.used,c.available,c.total select c).take(1); this.serversusageramsviewsource = (collectionviewsource)this.findresource("ramview"); serversusageramsviewsource.source = ramlist; }
well guess should have 2 series.
<dvc:chart ...> <dvc:chart.series> <dvc:pieseries itemssource="{binding}" dependentvaluepath="available" /> <dvc:pieseries itemssource="{binding}" dependentvaluepath="used" /> </dvc:chart.series> </dvc:chart>
disclaimer - didn't test it, that's try.
Comments
Post a Comment