wpf - Editing CodePlex Source Code -
i new wpf - , visual studio - , using modern ui (metro) charts in application great effect. problem have, however, need change part of source code implement particular chart project.
specifically, need change hard-coded height , width of radial gauge piece (part of radial gauge chart) can scaled. have found example of code (see below) can't figure out implement it. original in generic.xaml
part of download.
<style x:key="radialgaugechartchartareastyle" targettype="chart:chartarea"> <setter property="template"> <setter.value> <controltemplate targettype="chart:chartarea"> <grid> <viewbox height="auto" width="auto"> <contentcontrol content="{templatebinding content}" verticalalignment="stretch" horizontalalignment="stretch" verticalcontentalignment="stretch" horizontalcontentalignment="stretch" /> </viewbox> </grid> </controltemplate> </setter.value> </setter> </style>
i not looking me, pointer in right direction - i'm stumped.
you don't need modify style of chart.
if fact, quite simple scale chart of viewbox
. have define decent size
chart - large enough accommodate series, not over-sized.
for example, if series has 4 entries, can define decent size
of 800 x 600 chart. if series has more entries, define bigger size.
<metrochart:radialgaugechart width="800" height="600"> <metrochart:radialgaugechart.series> <metrochart:chartseries> <!----> </metrochart:chartseries> </metrochart:radialgaugechart.series> </metrochart:radialgaugechart>
and put inside viewbox
.
<window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:metrochart="clr-namespace:de.torstenmandelkow.metrochart;assembly=de.torstenmandelkow.metrochart" x:class="wpfapplication1.mainwindow" title="mainwindow" height="800" width="1000"> <grid> <viewbox> <metrochart:radialgaugechart width="800" height="600"> <metrochart:radialgaugechart.series> <metrochart:chartseries seriestitle="errors" displaymember="category" valuemember="number" itemssource="{binding path=errors}"> </metrochart:chartseries> </metrochart:radialgaugechart.series> </metrochart:radialgaugechart> </viewbox> </grid>
viewbox
can scale chart nicely in available space.
Comments
Post a Comment