Whenever you add a subplot to any combinedplot in jfreechart, it adds the new subplot BELOW the previous plot. Is there a simple way to do this or I have to manually reverse the order using a loop?
In a CombinedDomainXYPlot for example, the List of subplots is implemented as an ArrayList, and they are rendered in the order in which they were inserted. To replace a subplot, one simple expedient would be to remove() all subplots and add the new entries in the desired order.
Related
I have a bar chart with different bar colors. Below in a table I just want to indicate what each color means.
Can I do something like that in SSRS?
Im sure I can create another column on a left and assign each color to a cell. But is any way I can display it the way its on a picture above?
I tried to use indicators for that but I guess it needs conditions.
You can do this with custom code.
Loose steps to follow are:
Create a list to hold the graph
Add the graph
Inside the list and below the graph, add a tablix
The tablix will row group on the same thing as the graph (so you can get a row per coloured item in the graph)
Add a column to the start of the tablix for the colour
Add the following custom code:
Private colourPalette As String() = {"#418CF0", "#FCB441", "#DF3A02", "#056492", "#BFBFBF", "#1A3B69", "#FFE382", "#129CDD", "#CA6B4B", "#005CDB", "#F3D288", "#506381", "#F1B9A8", "#E0830A", "#7893BE"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColour(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colourPalette(count Mod colourPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
For the series fill on the graph, use the follow expression:
Use the same expression for the fill on the initial column in the tablix
You can use any list of codes for colour - this is the list for the default palette in SSRS.
This code ensures the same colour is picked each time the same item is used - so in the image the same colour is returned each time the same Category is returned.
The solution I use is pretty simple.
I use Windows Character Map to find a character I like. For example: ■
Copy that character and add an expression where you want to show the color icon. Your expression text will be
="■"
Then go to the Font tab and Color. Select the color you want from the menu. You can use expression logic in here to change the color dynamically. (You can refer to other answer for details there)
So I have a working XYPlot but I want to add different colors to the background, not a single one. I know this appears to be doable for quadrants, but I want it basically row by row, or ranges of rows I should say.
Basically something like this :
but with ideally 3-4 colors instead of just 2. Can you set the background paint for a specified Axis range for example? I haven't found any info or way to do it yet.
IntervalMarker "Represents an interval to be highlighted in some way." In the example below, two markers span the plot's range.
XYPlot plot = new XYPlot(…);
plot.addRangeMarker(new IntervalMarker(.3, 1, new Color(0x60CCFFE5, true)));
plot.addRangeMarker(new IntervalMarker(0, .3, new Color(0x60FFCCE5, true)));
Wondering if there is an method to save the image of multiple (overlapping) elements in WPF. I know you can pass and element to something such as, 'bitmap.Render(visual)' but if we have for example a polygon and a circle on top of an image we would like to save the combined elements (eg: flatten these layers) and save the image to a file.
Only way I can think of is to create a new container such as a panel, remove the items from the existing one and add to the new one. Get the visual then add them back.
That or Clemens good comment on the original post.
In EXTJS PIE Chart i want to sort top 10 values and display in Descending order.
Currently it gets all records from store and displays. I need only top 10.
Can anyone guide me to solve this issue?
Thanks
I do not think it's' pie charts' job to show top 10 values. you should provide a process that will transofrm the original store in what you really need. A plugin that replaces the original store might be an ideea.
You can try sorting and filtering the store. I manipulated example code in ExtJS docs and figured, that data is displayed by given order. Maybe if you apply sorter to store you might get desired effect. As for filtering: find min value of top ten values and apply filter that leaves only values above it. Might work, but I haven't tried it.
In my program I need to display a JFreeChart.
I'm adding, over time, series to that JFreeChart.
I'm having a tree who allows me to switch between different item and displaying them in the chart. What i do is that I update the TimeSeriesCollection. (Update or reset completely with new data)
But I need in a specific case to add data to one of my item, thus displaying the chart with the new data, and at the same time, the user might change item and the program still needs to update my 1st item while displaying the second.
Which mean i have a graph of "Item1" to which I'm adding data over time, and while doing that, i want to be able to switch to an "Item2" and displaying that item in the graph (while still adding my data to "item1")
I tough about using an other TimeSeriesCollections to wich i could put the new data while displaying the first TimeSeriesCollections. But i can't seem to find a way to switch between 2 TimeSeriesCollection.. like a myJFreeChart.setTimeSeriesCollection(TimesSeriesCollections tsc)
Any ideas?
As shown here, create your chart with a TimeSeriesCollection. As long as you have distinct TimeSeries instances, you can use removeSeries() and addSeries() to swap them as required. The ChangeListener will be adjusted accordingly. You can still add data to either series.
If you're still having problems, edit your question to include an sscce.