I'm trying to prevent a default chart item roll over highlight in a Spark column chart.
If you look at any of the chart examples on this page , when you roll over any of the chart series items, they turn a darkened shade of their original colour. This is what I want to prevent.
So far I have had no luck with using the itemRollOverColor property, as this only allows you to set it to one specific colour for the whole chart (my app has several different coloured series on the chart at once). Also, trying to leverage the itemRollOver event (with preventDefault() etc) hasn't worked either.
Does anyone have any idea what I am missing here?
Thanks for reading guys
Remove chart's selectionMode property or set it to "none".
If you realy need multiple ChartItem selection you'll have to override default item renderer by creating a class that implements IDataRenderer interface and setting itemRenderer style to your class for the chart series
Related
I assume I need to override the mouse over and mouse off event so that they don't do anything and then trigger the mouse over event for each column on the graph.
Anybody got any suggestions?
What you are looking for is the property showAllDataTips for the chart to true.
This will force all the available dataTips on the chart to become visible.
I guess this should do what you are trying to get done.
The mouseover event for the graph seems a long shot but its still feasible incase you want to show data tips on some kind of interaction.
But I would suggest on mouse rollover , change showAddDataTips= true and on rollOut showAllDataTips=false .
That should do the trick.
You probably want to use data labels:
By default, BarSeries, ColumnSeries, and PieSeries objects do not
display data labels.
To enable data labels on BarSeries and
ColumnSeries objects, set the value of the labelPosition property
to inside or outside.
To enabled data labels on PieSeries, set the value of the
labelPosition property to inside, outside, callout, or
insideWithCallout.
Cheers!
On my flex (flash builder 4) DataGrid - DataGridColumn , I have set a custom itemRenderer
itemRenderer="myComponents.EncounterDGItemRenderer".
My renderer is a Label
public class EncounterDGItemRenderer extends Label
I found that my tooltips (datatips) stopped working once I started using this custom renderer. I also found that I can set the tooltip on the label in the
override protected function updateDisplayList
by setting:
toolTip=data['addedDate'];
This works find, however the problem is I need to choose a different data field based on the column. I was hoping for something similar to how a DataGridColumn labelFunction works - where I have access to "column.headerText" or "column.dataField". However I only have access to the underlying data object, not the name of what is being displayed (unless I am missing something).
Is there a way in a data grid item renderer to know what the column header text is, or do you have a different approach?
So I came up with an answer that seems to work - I used a custom item renderer extending DataGridItemRenderer instead of extending 'Label'. Then, I set background = true and backgroundColor in there based on 'data' like I did above.
Then, the normal mxml show data tips / data tip field properties in the data grid columns work fine.
It makes sense though, this component should probably be upgraded to use Spark datagrid components - I am guessing that will allow background color and tool tips.
Brief description: If I create a customized LineSeries class and add that one to my project, even if it's the same as original, I lose data tip functionality.
Elaborated description:
I'm using a LineChart component and I needed to render my lines so that they change color according to some value ranges. So I modified LineRenderer, applied it to my LineSeries and everything was working great. Unfortunately I later realized that I will need to supply ranges and colors dynamically as they're supposed to be customizable. This is where it gets tricky.
This is the code I use to set my lineRenderer:
var cf:ClassFactory = new ClassFactory(myLineRenderer);
lineSeries.setStyle("lineSegmentRenderer",cf);
I did not find a way to dynamically change data on a ClassFactory without making an instance of it. But if I make an instance of it, I can not set it as a style. If anyone knows of a way to do this, it would solve my problem straight out. All I need is to set an array property inside myLineRenderer. But it makes sense to me why this can't be done.
Can I dynamically make a new Class that is a clone of myLineRederer yet has one property changed?
Can I add an argument to myLineRenderer constructor? If so, how would that work with the code above?
Anyway, since that didn't work, I figured I needed to change the data supplied to myLineRenderer. For this I created my own LineSeries that has a settable Array property that it adds to the data passed to myLineRenderer. And it works great. With one little kink. As soon as I change my LineChart series from LineSeries to myLineSeries, I can't move the mouse cursor along the line and get info on each item in the chart. I removed all the changes I made to original LineSeries, but it makes no difference. What am I missing?
Right now I'm trapped between having customizable color ranges with no data tips and non-customizable color ranges with data tips. The former is still better, but I would really need both to work or at least know why that's impossible.
Any help would be much appreciated.
Take a look at the properties property of ClassFactory
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.html#properties
I think that does exactly what you need it to.
I have a single series bar chart created programmatically in codebehind which I would like to display the Y point value (somewhere above the bar, or maybe as a tooltip) when the user hovers their mouse over a bar.
Is there a native onmouseover event for the bars of the chart, or is it something that should be added through series.MapAreaAttributes?
Thanks!
Edit
After some experimenting I've found the points.tooltip attribute which I can add at the same time I add the point which will do what I want it to do, but it would still be nice to know if you can capture events for the bars, just for future reference.
From Show all series' values in stacked bars mouseover (ASP.NET CHART)
series.MapAreaAttributes = "onmouseover=""showTooltip('#VALY');"""
Where your showTooltip function would do as you required.
I'm building a simple Flex applicaton where I want to show a line chart, then display some information in a little popup box when user mouses over a line.
You can set the showDataTips property of the LineChart to true. The property is defined in the ChartBase base class, which LineChart extends. More information about showDataTips is here:
http://livedocs.adobe.com/flex/3/langref/mx/charts/chartClasses/ChartBase.html#showDataTips
You can customize what is displayed in the data tip callout by specifying a custom dataTipFunction.
Using data tips will give you call outs as you mouse over the points that make up the line. If you want to provide information about the line in general you should couple the chart with a Legend to describe what the line represents. Creating a legend is as simple as this (where lineChart is the id value of your LineChart):
<mx:Legend dataProvider="{lineChart}" />