Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question How do I add a background Image to a CRM 2011 Chart

    Im trying to add an image to the background of a radar chart in crm 2011 using XML. I've tried this:

    Code:
        <ChartAreas>  
                 <ChartArea BackImage="c:\test\wheeltest1.jpg" BorderColor="White" BorderDashStyle="Solid">
    Where the image is on the root of the application server but I get the following error:

    > An Error Occurred Whilst the Chart Was Rendering

    Any ideas where I'm going wrong?

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,092
    Thanks
    23
    Thanked 594 Times in 593 Posts
    Showing a small section of xml does not tell us what you tried to cause the error. Please give us a little more, if not all, of the xml and the coding you used to read it.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    CRMDaveUK (04-18-2013)

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    As Requested

    Code:
    <visualization>  
       <visualizationid>{8BADBB34-01E6-E011-80C0-00155D18443B}</visualizationid>  
       <name>Outcome Scores</name>  
       <description>Shows the value of scores at initial and last review stages.</description>  
       <primaryentitytypecode>cw_outcomescore</primaryentitytypecode>  
       <datadescription>  
         <datadefinition>  
           <fetchcollection>  
             <fetch mapping="logical" aggregate="true">  
               <entity name="cw_outcomescore">  
                   <attribute alias="Review" name="cw_reviewscore" aggregate="sum"></attribute>   
                   <attribute alias="Initial" name="cw_initialscore" aggregate="sum"></attribute>    
                   <link-entity name="cw_outcomescoretype" from="cw_outcomescoretypeid" to="cw_outcomescoretypeid" link-type="outer">  
                     <attribute groupby="true" alias="groupby_cw_outcomescoretype" name="cw_name" />  
                   </link-entity>    
               </entity>  
             </fetch>  
           </fetchcollection>  
           <categorycollection>  
             <category>  
               <measurecollection>  
                 <measure alias="Review" />  
               </measurecollection>  
               <measurecollection>  
                 <measure alias="Initial" />  
               </measurecollection>  
             </category>  
           </categorycollection>  
         </datadefinition>  
       </datadescription>  
       <presentationdescription>  
        <Chart Palette="None">  
           <Series>
             <Series ChartType="radar" Name="Review" Color="149, 189, 66" IsValueShownAsLabel="False" BackGradientStyle="TopBottom" BackSecondaryColor="112, 142, 50" Font="{0}, 9.5px" LabelForeColor="59, 59, 59">  
               <SmartLabelStyle Enabled="True" />  
             </Series>  
             <Series ChartType="radar" Name="Initial" Color="255,124,31" IsValueShownAsLabel="False" BackGradientStyle="TopBottom" BackSecondaryColor="235,98,0" Font="{0}, 9.5px" LabelForeColor="59, 59, 59">  
               <SmartLabelStyle Enabled="True" /> 
             </Series>  
           </Series>  
           <ChartAreas>  
             <ChartArea BackImage="c:\test\wheeltest1.jpg" BorderColor="White" BorderDashStyle="Solid">  
               <AxisY LabelAutoFitMinFontSize="8" TitleForeColor="Transparent" TitleFont="{0}, 10.5px" LineColor="189, 201, 217">  
                 <MajorGrid LineColor="189, 201, 217" />  
                 <MajorTickMark LineColor="189, 201, 217" />  
                 <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />  
               </AxisY>  
               <AxisX LabelAutoFitMinFontSize="8" TitleForeColor="Transparent" TitleFont="{0}, 10.5px" LineColor="189, 201, 217">  
                 <MajorGrid Enabled="False" />  
                 <MajorTickMark Enabled="False" />  
                 <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />  
               </AxisX>  
             </ChartArea>  
           </ChartAreas>  
           <Titles>  
             <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title>  
           </Titles>  
           <Legends>  
             <Legend Alignment="Center" LegendStyle="Table" Docking="Bottom" Font="{0}, 11px" ForeColor="59, 59, 59"></Legend>  
           </Legends>  
         </Chart>  
       </presentationdescription>  
       <isdefault>false</isdefault>  
     </visualization>
    Last edited by Alex Vincent; 04-18-2013 at 06:29 PM. Reason: adding code tags

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,092
    Thanks
    23
    Thanked 594 Times in 593 Posts
    Where are my manners? Welcome to the forum CRMDaveUK. Thanks for the xml. If you'd have included the coding you used to read it I could have found your mistake.

    Now I have to guess. My guess is your using javascript to read the xml and apply the results to html.
    Here's how I would have done it:
    Code:
    <!DOCTYPE html>
    <html>
    <body>
    <div id="radar" style="width:400px;height:600px;"><img id="rad" src=""></div>
    
    <script>
    function loadXMLDoc(dname)
    {
    if (window.XMLHttpRequest)
      {
      xhttp=new XMLHttpRequest();
      }
    else
      {
      xhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xhttp.open("GET",dname,false);
    xhttp.send("");
    return xhttp.responseXML;
    }
    
    xml=loadXMLDoc("test3.xml");
    path="/visualization/presentationdescription/Chart/ChartAreas/ChartArea"
    // code for IE
    // did not do this for IE
    
    // code for Mozilla, Firefox, Opera, etc.
    if (document.implementation && document.implementation.createDocument)
    {
    var nodes=xml.evaluate(path, xml, null, XPathResult.ANY_TYPE, null);
    var result=nodes.iterateNext();
    var pic = result.getAttribute('BackImage');
    var back = result.getAttribute('BorderColor');
    var board = result.getAttribute('BorderDashStyle');
    document.getElementById('radar').style.backgroundColor = back;
    document.getElementById('radar').style.border = board;
    document.getElementById('rad').src = pic;
    }
    </script>
    </body>
    </html>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •