locked
Issue regarding PIE Chart RRS feed

  • Question

  • Hi,

    I have a Pie chart which is based on out-of-box 'Activity' entity. The issue is regarding the following line:-

    <attribute groupby="true" alias="groupby_column" name="scheduledend" dategrouping="week" />
    

    Since, I am doing grouping on the 'Weekly' basis, due to which 'Horizontal (category) axis labels' are coming as Week 51 of 2011, Week 52 of 2011, etc. What I want is to modify this axis labels as Week 1, Week 2...? But, I am unable to find the solution for it. Any idea, any workaround is highly appreciated.

    Btw, following is the XML which I am using :-

    <visualization>
      <visualizationid>{4930EBE4-3317-E111-B519-005056B20058}</visualizationid>
      <name>Upcoming Activities</name>
      <primaryentitytypecode>activitypointer</primaryentitytypecode>
      <datadescription>
        <datadefinition>
          <fetchcollection>
            <fetch mapping="logical" aggregate="true">
              <entity name="activitypointer">
                <attribute alias="aggregate_column" name="activityid" aggregate="count" />
                <attribute groupby="true" alias="groupby_column" name="scheduledend" dategrouping="week" />
                <filter type="and">
                  <condition attribute="scheduledend" operator="next-x-weeks" value="4" />
                  <condition attribute="scheduledend" operator="not-null" />
                </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">
              <SmartLabelStyle Enabled="True" />
            </Series>
          </Series>
          <ChartAreas>
            <ChartArea>
              <Area3DStyle Enable3D="true" />
            </ChartArea>
          </ChartAreas>
          <Legends>
            <Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
          </Legends>
          <Titles>
            <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title>
          </Titles>
        </Chart>
      </presentationdescription>
      <isdefault>false</isdefault>
    </visualization>
    

    Thanks.


    Software developer working on Asp.Net, C#, jQuery and Dynamics CRM
    Monday, December 5, 2011 10:35 AM

Answers

All replies

  • The charts are based on ASP.NET chart control. So this can be achieved by using the property 'Label' on series:
    http://msdn.microsoft.com/en-us/library/dd456687.aspx

    in the above XML use:

    <Series Label="Week #INDEX" ShadowOffset="0" IsValueShownAsLabel="false" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">


    Murali
    Wednesday, December 7, 2011 2:26 AM
  • Dear Muralikrishnan,

    Thanks for the reply. The solution provided by you worked good. After evaluating my situation, I feel I need to alter the "Legend", I tried to alter it from your helpful post, but still didn't get the results as appropriate. Following is the XML, I am using:-

    <visualization>
      <visualizationid>{4930EBE4-3317-E111-B519-005056B20058}</visualizationid>
      <name>My Team's Aging Activities</name>
      <primaryentitytypecode>activitypointer</primaryentitytypecode>
      <datadescription>
        <datadefinition>
          <fetchcollection>
            <fetch mapping="logical" aggregate="true">
              <entity name="activitypointer">
                <attribute alias="aggregate_column" name="activityid" aggregate="count" />
                <attribute groupby="true" alias="groupby_column" name="scheduledend" dategrouping="week" />
                <filter type="and">
                  <condition attribute="scheduledend" operator="next-x-weeks" value="4" />
                  <condition attribute="scheduledend" operator="not-null" />
                </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">
              <SmartLabelStyle Enabled="True" />
            </Series>
          </Series>
          <ChartAreas>
            <ChartArea>
              <Area3DStyle Enable3D="true" />
            </ChartArea>
          </ChartAreas>
          <Legends>
              <strong><Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59">
                  <CellColumns>
                      <LegendCellColumn Text="Next #INDEX Week" ColumnType="Text" >
                      </LegendCellColumn>
                  </CellColumns>
                  <CellColumns>
                      <LegendCellColumn ColumnType="SeriesSymbol">                    
                      </LegendCellColumn>
                  </CellColumns>
              </Legend> </strong>                   
          </Legends>
          <Titles>
            <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title>
          </Titles>
        </Chart>
      </presentationdescription>
      <isdefault>false</isdefault>
    </visualization>
    

    After doing these changes, it start appearing like the below:-


    Now, the issue is I am unable to make Week 50 of 2011 as Next 1 Week and Week 52 of 2011 as Next 3 Week. In the Text property of LegendCellColumn, I am using "Next #INDEX Week".

    Thanks.


    Software developer working on Asp.Net, C#, jQuery and Dynamics CRM
    Thursday, December 8, 2011 6:36 AM
  • I see the problem but the issue is that indexes are zero-based. I went over the other supported keywords and there is none relevant to your scenario.
    Murali
    Thursday, December 8, 2011 7:16 PM
  • Ok. Is there any way that I can read the Legend Value Week 50 of 2011, then alter it and extract the value '50' and do some more processing on it?

    Btw, I really appreciate the efforts put by you in this issue. Thanks for your time.


    Software developer working on Asp.Net, C#, jQuery and Dynamics CRM
    Friday, December 9, 2011 11:33 AM