This is a migrated thread and some comments may be shown as answers.

Legend label formatting?

9 Answers 224 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 01 Jul 2010, 05:58 PM
I have been exploring your example here: http://demos.telerik.com/silverlight/#Chart/Aggregates and it is mostly what I want.  I'd like to add some additional information - namely I have two series (before grouping), call them Size and Number, and I'd really like the legend items to look like:

GroupName1 (size)
GroupName2 (size)
GroupName3 (size)

GroupName1 (count)
GroupName2 (count)
GroupName3 (count)

I am currently using a StackedBarSeries which adds up the GroupNamex contributions quite nicely.  It would  be handy if there was some LegendFormat that would let me say

LegendLabelFormat = "#SERIESLABEL (size)"

Is there any way to do this (while auto generating the legend items)?  LegendItemLabelFormat looked promising but it seems to be ignored.

Thx,
Tim

9 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 06 Jul 2010, 10:01 AM
Hi Tim,

Maybe the STSUM and STPERCENT tokens will do the job? Check this article out. If the desired token is not there please let us know exactly what you need and we will consider adding it to RadChart.

Greetings,
Vladimir Milev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 06 Jul 2010, 03:43 PM
Hi Vlad,

I've read (quite thoroughly in fact) the format expressions reference - I asked in another thread about a format expression to get MB, GB, TB, etc. (I'm working on a storage product).  I went as far as putting every one of those format expressions in as many labels/tooltips/etc. as possible to figure out which ones I wanted to actually use.   It would appear that the LegendItemLabelFormat property has no impact on the legend for my stacked bar chart with aggregation.

Essentially all I am looking for is to add the UNITS to the legend - literally I just want to distinguish which colors are the counts and which are the sizes.  I tried LegendItemLabelFormat = "#SERIESLABEL (bytes)" and LegendItemLabelFormat = "#SERIESLABEL (files)" but they don't seem to have any effect.

    public class MyFilesSeries : StackedBarSeriesDefinition 
    { 
        public MyFilesSeries() 
        { 
            AxisName = "Files"
            ItemToolTipFormat = "#XCAT (#SERIESLABEL): #Y{###,##0}/#STSUM files (#STPERCENT{#0.#%})"
            ShowItemToolTips = true
            ShowItemLabels = false
            LegendItemLabelFormat = "#SERIESLABEL (bytes)"
            LegendDisplayMode = LegendDisplayMode.SeriesLabel; 
        } 
     
 

Changing the LegendDisplayMode to None removes the labels, and DataPoint does show the values.

Thanks,
Tim

0
Vladimir Milev
Telerik team
answered on 09 Jul 2010, 09:29 AM
Hello Tim,

I have been working on your case for a while but I am unable to reproduce the problem you are having :-(
Can you please send me your project or a small runnable sample if it is too big. Once I have that I can verify your findings and offer a work-around or even a bugfix in the product if necessary.

Thanks for your patience and cooperation!

All the best,
Vladimir Milev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 09 Jul 2010, 02:19 PM
Hi Vlad,

I've attached a screen capture of a demo application and added the labels in red using the capture tool--I want to have a per-series label appear next to the group-by labels in the legend, as shown in the attached.

I have a 33K .zip file demo project, but i can't attach .zip files.  I can rename it .png or open a support ticket if you wish.

Tim
0
Vladimir Milev
Telerik team
answered on 15 Jul 2010, 11:46 AM
Hello Tim,

You can open up a support ticket and attach the project if you wish. It will help us a lot. I have a question, the "(files)" text an the "(sizes)" does it come from a column in your data table or is it derived based on some logic?

Right now RadChart does not offer such functionality which allows you to customize the auto generated legend text when grouping but based on your feedback we will consider how we can implement it. I will be happy if you provide answers to my questions. Thanks a lot for your time.

Your telerik points have been updated.

Sincerely yours,
Vladimir Milev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 15 Jul 2010, 02:18 PM
Hi Vlad,

Neither one is based on any property of the databound collection.  In this case, I add two data series, one for the number of files and one for the size.  The grouping is by a filter property.  In this case, the (files) or (size) could come from the name, or a property for the name, of each data series.  A formatting expression would work, such that #SOMEEXPRESSION represents the generated (grouped) label, but so I could say EXPR = "#SOMEEXPRESSION (files)", or EXPR = "#SOMEEXPRESSION (#SERIESNAME)".  Either one would meet my needs and you should go with consistency in the product.

By the way, kudos to the development team for the recent graph work - all our customers a delighted with it, and a few have commented on the improved Office_Blue theme.

I entered ticked #328375.  You've answered my question, so consider it a feature request. 

Tim
0
Ves
Telerik team
answered on 20 Jul 2010, 11:47 AM
Hi Tim,

Indeed, your feedback is valuable and I have logged your request in our public issue tracking system - link.

For the time being and given some additional knowledge (there are 3 filter types - "Microsoft Office", "Music and Video" and "Others") you can achieve the desired result by altering the legend labels manually. For this purpose wire the DataBound event in RadChart and update the LegendLabel property of each data series:

void TheAtomChart_DataBound(object sender, ChartDataBoundEventArgs e)
{
    RadChart chart = ((RadChart)sender);
    for (int i = 0; i < chart.DefaultView.ChartArea.DataSeries.Count; i++)
    {
        if (i < 3)
            chart.DefaultView.ChartArea.DataSeries[i].LegendLabel += " (files)";
        else
            chart.DefaultView.ChartArea.DataSeries[i].LegendLabel += " (bytes)";
    }
}

A slightly enhanced version would involve keeping all the updated legend labels in a list, so if you reach a repeating legend label, you would know that it is for bytes and not for files. You can find the updated files attached. I hope this is applicable.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 19 Nov 2010, 09:11 PM
Any activity on this?  The PITS link above doesn't seem to take me to my issue.

Tim
0
Ves
Telerik team
answered on 24 Nov 2010, 05:49 PM
Hi Tim,

I just checked the link and it seems to work fine for me. Just make sure you give it enough time (like a second or so) after the list of issues is displayed so that the details are loaded. I am sorry to say, though, we have no progress on the feature request itself. Please, accept our apologies.

Best regards,
Ves
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Tim
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Tim
Top achievements
Rank 1
Ves
Telerik team
Share this question
or