How can we extend chart legend in Foundry-Slate - palantir-foundry

In slate, chart widget have label option that display legend (color dot + label name) at some place of the chart (top, left, bottom, ...).
I notice 2 limitations with this legend on bar chart and I would like to improve them on my Slate apps.
1 issue: label are ordered in the order series appears on the bar chart (from left to right).
2 issue: when segmented and not-segmented data are stacked on the bar chart, label of not-segmented data have wrong color (even if we set series color parameter, and if we don't color attribution is random and change from one loading to the next).
For that reason I decided to produce my on labels in an HTML widget. I get a nice result just with a function that sort label and return a <div class="bp3-label" style="background:${labelColor};">${labelName}<\div> for each label. But I loose the interactivity (this is a convenient function of labels).
Is there a way to transfer this interactivity to my "custom label" and make click on this selecting all relevant bars on my bar chart?
I'm thinking to use slClickEvent and slClickEventValue props on the DIVs to push data relative to the clicked Label in a variable and to make the bar chart "selectedValue" property dependant of this variable.
Is it the best ways ?
Will the bar be highlighted in accorance with chart "selectedValue"?

You're on the correct track here - I often build custom chart legends in an HTML widget to have more control over the appearance and interaction compared to the native legend. If you search on your Foundry instance, you'll even find a folder of Slate apps that are examples of different HTML widget patterns, including one called HTML - Legend that shows some examples with custom CSS and Blueprint styles.
For the interactivity, I'd probably go with using custom HTML selection, rather than custom HTML click events, because with the custom selection, Slate will automatically add a selected class to whatever element you've added the selection to, which will make it easy to update the styling to reflect the selection.
Nothing would stop you from doing this with custom clickEvents instead, but you'd then need to also do some more work to reflect the selection status in the legend or else go without that extra affordance.
If you search your Foundry instance for Line Chart Series Selection with Custom Legend you'll find an example that shows exactly this. In that specific example, the Line "selection" is indicated on the chart by changing the line styling; with a Bar chart, you'd actually want to template (with Handlebars) the selection status of the chart in the </> panel. Then, when the user makes a selection using the legend, the chart will reflect that selection as if they'd chosen by clicking on the bars themselves.

Related

report server (ssrs): how to handle long names on vertical axis

I have a chart built in Report Builder (MS Reporting Services), where vertical axe is categorical.
Label names of categorical axe is very long.
Is it possible to shrink the length of names for first 10 symbols and show full names when mouse coursor is over the names?
I don't think this is possible natively in SSRS but you might be able to get an acceptable compromise.
First click on the chart, so the config pane opens, click on your category group and then edit the label property to something like this
=LEFT(Fields!Caption.Value, 10)
(Caption is the name of the field containing the label that appears on the Y axis in my case)
Now that you have the shortened name showing you need to show the full name somewhere. Unfortunately, the group labels do not support tooltips but chart series do.
Click anywhere on the bar (but not on the data label) and then set the tooltip property to something like
=Fields!Caption.Value & " " & Fields!Amount.Value
When we run the report and hover the mouse over the 3rd green bar, we get the following...

Report Builder 3.0, breaking out data field for Bar Chart

I'm using Report Builder 3.0 and trying to figure out if i can break out one datafield with the few values I need for my bar chart. The data looks like this;
[[44278,47411],[{"name":"$41,000/year goal","y":41000}],["",""]]
I want bar 1 to be the 44,278 value, bar 2 to be the 47,411 value and the 41000 to be embedded as a goal. I've attached a screenshot of how we have it working with other grid and charting products, but this is going to be embedded in a much more in-depth SSRS report. Any sort of help would be great as i'm new to the whole SSRS reporting system.
You can do this with a custom StripLine:
Right-click the vertical chart axis and click Vertical Axis Properties.
The axis properties are displayed in the Properties window.
In the Appearance section of the Properties pane, for the StripLines property, click the Edit Collection (…) button to open the ChartStripLine Collection Editor.
Click Add to add a new strip line to the collection.
Click StripWidth to specify the width of the strip line. If your goals will fluctuate, you might want to make it relative to your Goal e.g. =Fields!YourGoalField.Value/100
Set the StripWidthType property to Number.
Set the InvervalOffset value to =Fields!YourGoalField.Value.
Set the IntervalOffsetType value to Number.
More on StripeLines: http://technet.microsoft.com/en-us/library/dd239316.aspx
EDIT To get the Goal Label outside the Chart Area as depicted, we have to do a sort of hack:
Delete the StripLine Title as there is no way to get that outside the Chart Area.
Right Click the Chart and select Add New Title.
On your new Chart Title's Properties Pane
Set the Docking Position to Right Center.
Set the TextOrientation to Horizontal.
Adjust the Font style and color to match your spec.
Set the Caption Expression to =Format(Fields!YourGoal.Value,"$0,000") & "/year goal"
Here is where the hack comes in. In order to get the Goal label to line up with the Goal Line, you need to add a certain number of carriage return/line feeds to your Caption Expression. To do this, append & vbcrlf to the Caption Expression a bunch of times and keep testing until it lines up. You might also want to adjust the DockingOffset property to move the Label closer to the Chart Area.

In SSRS how to conditionally change the colour of a datalabel font on a chart when it appears on the bar

I have created a bar chart that shows values on data labels.
The Data label is placed outside the bar
But in some cases the label appears on the bar where the bar is too long.
In this scenario I would like to conditionally change the font/colour of the data label so that it's more visible.
However I can't see a way to dynamically determine where the label has been placed.
What I can think of is this. You can change the background/font color of all those series labels who's value lies in the range of 95%-100% of the maximum "Value". To be exactly precise as to what should be the threshold to change the bg/font color seems a daunting task, but you could play around with test data.
For writing the expression to change the font color,I would first change the dataset and add a column on the lines of PercOfMax. This column can be calculated easily in the dataset by using basic aggregate functions.
Then you need to go to the Chart Series Label properties-->Color and write the expression on the lines of -
=IIF(Fields!PercOfMax.Value>=95, "YELLOW", "BLACK")
As I said, you might need to do some more research to finalize the value of this threshold(which I am assuming to be 95).
Another solution to this problem is to use fill colour of the label and set its background to a bright colour (e.g. colour), and leave the font colour of the label black. Thus you can always see the label, and there is no difference when it's outside of the bar.

SSRS 2005 Charts: Customize line colors using expression?

Is there a way to change the color of specific line items in an SSRS chart? For example, in the Data tab using an expression within a series group or the values area, or perhaps with a variable? I'm not terribly keen on the color palette that in my current chart, wanting certain areas to stick out a bit more and not sure how to get started.
Thanks.
We do this to ensure different departments are coloured consistently across all reports. In our database we have a colour field on our department table, then in the bar graphs we do the following:
Right click the chart body and choose Properties
Click the Data tab
In the Values section, click the Edit button
Click on the Appearance tab
Click the Series Style button
Click the Fill tab
In the Color text box, put the expression that you want the colour to be. Given that we have this in our department database already, we simply use:
=Fields!DeptColour.Value
and then our departments are coloured the same on every bar graph.
For line graphs, you have to do the same except this time you put the colour expression in the Color text box on the Border and Line tab on the Series Style dialogue (rather than in the Fill).

Checkbox Images in List

It seems like it should be a simple concept. I need a vertical list. This list has an image with a checkbox and pathname of that image underneath it. The user should be able to check the checkboxes of the images they want to appear in their "shopping cart". The images, checkbox label, and list are populated by an XmlList. How can I do this in Flex 3.5 and Actionscript and have a button that when clicked, display a list of the checked items??
You need to write a custom list item-renderer.
Here are same docs http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_2.html