MS CRM 2011 Customizing Chart Legend
-
10. april 2012 14:33
I would like to customize the legend on my pie chart for the case entity. I would like the labels on the legend to be Due this week, Due next week and due this month. By default the labels are Week 1 of 2012, Week 2 of 2012 and so on when the dategrouping is set to week.
Here is my current xml code:
<visualization> <visualizationid>{A3E83100-817E-E111-9D70-00155D01C236}</visualizationid> <name>Follow Up Pie Chart</name> <primaryentitytypecode>case</primaryentitytypecode> <datadescription> <datadefinition> <fetchcollection> <fetch mapping="logical" aggregate="true"> <entity name="case"> <attribute alias="aggregate_column" name="name" aggregate="count" /> <attribute groupby="true" alias="groupby_column" name="followupdate" dategrouping="week"/> <filter type="and"> <filter type="or"> <condition attribute="followupdate" operator="this-week" /> <condition attribute="followupdate" operator="next-week" /> <condition attribute="followupdate" operator="this-month" /> </filter> </filter> </entity> </fetch> </fetchcollection> <categorycollection> <category> <measurecollection> <measure alias="aggregate_column"/> </measurecollection> </category> </categorycollection> </datadefinition> </datadescription> <presentationdescription> <Chart Palette="None" PaletteCustomColors="97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83; 148,172,215; 217,148,147; 189,213,151; 173,158,196; 145,201,221; 255,180,138"> <Series> <Series ShadowOffset="0" IsValueShownAsLabel="true" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie" IsVisibleInLegend="true"> </Series> </Series> <ChartAreas> <ChartArea> <Area3DStyle Enable3D="false" /> </ChartArea> </ChartAreas> <Legends> <Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59"> </Legend> </Legends> <Titles> <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title> </Titles> </Chart> </presentationdescription> <isdefault>false</isdefault> </visualization>
Here is what the current chart looks like:
Here is what I want it took like:
I tried hiding the default legend and showing a custom legend but it would be correct only if there was data in all three categories.
Alle besvarelser
-
10. april 2012 23:40
Hi Piyush,
I changed the legend. Have a look at my below 2 screen shots.I have used Visual Studio 2008 designer. You can save your report as *.rdl file and open it in VS 2008. Then in designer make changes, save, test it. Then import it back in CRM.
What you need to do is: Go to chart data box (near your chart in Visual Studio 2008 designer). Inside "Values" go to each of the "series properties". Then go to "Legend" on left hand side. Then enter a "custom legend text". You can also enter dynamic expression.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
- Foreslået som svar af Ashish Mahajan Australia (Architect) 10. april 2012 23:40
-
11. april 2012 23:21Hi Piyush,
If the response answered your question and you are satisfied, please mark the response as an answer. This will help others to search on similar problems.
Thanks in advance.Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
-
12. april 2012 04:18
Hey Ashish,
Thanks for the response. I was looking for a way to do this through the chart xml. Using the reporting approach would lose some other functionalties that comes with the chart feature.
-
12. april 2012 04:32
Hi Piyush,
Do one thing. Create a new report (same report) in Visual Studio and do what I said above. Then check the new report's XML (as it is a .rdl file).
Search for that code where it changes the legend label. Copy that XML code and paste it in your report (which you need to change).
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
- Foreslået som svar af Ashish Mahajan Australia (Architect) 12. april 2012 04:32
- Markeret som svar af Payman BiukaghazadehEditor 16. april 2013 03:57
-
12. april 2012 15:24
Hey Ashish,
That won't work. The XML schema for the report(.rdl) is completely different from the XML schema used in charts.
-
28. april 2012 12:45
Hi,
Use the LegendText property inside each series you want to change:
<Series ChartType="Bar" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40" LegendText="Apples"> <Series ChartType="Bar" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40" LegendText="Bananas"> <Series ChartType="Bar" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40" LegendText="Pears">That should achieve what you want.
- Foreslået som svar af LF3DBA 1. oktober 2012 21:13
-
29. marts 2013 06:10Besvarer
Refer to this link on WIKI:
If the answer helped you, remember to mark it as answer.
- Markeret som svar af Payman BiukaghazadehEditor 16. april 2013 03:57