windows 8 - How to set and get line series color from WinRT XAML Toolkit chart -


answer

thanks filip, found way set color. need add background property in datapointstyle. posting answer here. found way how modify default tooltip.

showing lines different colors on silverlight toolkit’s linechart?

using custom tooltip in silverlight charting

<charting:lineseries.datapointstyle>     <style targettype="charting:linedatapoint">         <setter property="width" value="17" />         <setter property="height" value="17" />         <setter property="background" value="lime"/>         <setter property="template">             <setter.value>                 <controltemplate targettype="charting:linedatapoint">                     <grid>                         <tooltipservice.tooltip>                             <contentcontrol content="{binding value,converter={staticresource myconv},converterparameter=test}"/>                         </tooltipservice.tooltip>                         <ellipse fill="lime" stroke="lime" strokethickness="3" />                     </grid>                 </controltemplate>              </setter.value>         </setter>     </style> </charting:lineseries.datapointstyle> 

question 1

i creating multiple line chart series in chart. winrt xaml toolkit assigns color each series in random manner. using custom style data points, when use custom style randomness of color goes off. how can set or random color of series ? if can color can use color in datapoint, , if can set color generate random color myself.

question 2

moreover while hovering on data points tool tip shows dependent value, want show more details how can achieve ?

here's code custom style.

<charting:chart x:name="linechart" title="line chart" margin="70,0">     <charting:lineseries                 title="population 1"                 independentvaluebinding="{binding name}"                 dependentvaluebinding="{binding value}"                 isselectionenabled="true">             <charting:lineseries.datapointstyle>                 <style targettype="charting:linedatapoint">                     <setter property="width" value="17" />                     <setter property="height" value="17" />                     <setter property="template">                         <setter.value>                             <controltemplate targettype="charting:linedatapoint">                                 <ellipse fill="green" stroke="green" strokethickness="3" />                             </controltemplate>                         </setter.value>                     </setter>                 </style>             </charting:lineseries.datapointstyle>         </charting:lineseries>      <charting:lineseries             title="population 2"             independentvaluebinding="{binding name}"             dependentvaluebinding="{binding value}"             isselectionenabled="true" foreground="blue">         <charting:lineseries.datapointstyle>             <style targettype="charting:linedatapoint">                 <setter property="width" value="17" />                 <setter property="height" value="17" />                 <setter property="template">                     <setter.value>                         <controltemplate targettype="charting:linedatapoint">                             <ellipse fill="red" stroke="red" strokethickness="3" />                         </controltemplate>                     </setter.value>                 </setter>             </style>         </charting:lineseries.datapointstyle>     </charting:lineseries> </charting:chart> 

chart random color (no custom datapoint style)

enter image description here

chart no random color (with custom datapoint style) [you can see both line has yellow color]

enter image description here

trying bing silverlight toolkit chart custom line color yields potentially useful pages, this. should work same winrt xaml toolkit, customize silverlight-based templates - need customize winrt xaml toolkit-based ones can either try extract blend/visual studio designer or original templates source can grab codeplex.


Comments