Can I pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5? - arrays

Is there anyway where I can pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5?
Here what I need: I have array values like this,
array1 = [23, 49, 40, 239, 20, 80, 39,49,120, 24, 31,41];
and I want to show these values on the Y-axis and months on X-axis.
I have two questions:
How can I pass this array to Bar chart or column chart?
How do I need to show months on X-axis? I have kept a filters that even if we want to see some months or a particular months or particular span of months. On X-axis it need to change the months dynamically depending on the filters. For example on X-axis the values should be [Jan, Apr, Jun, Oct] if I select the 3 months period filter
I have written a logic to collect the values of those particular months into an array, but I don't understand how to pass this array to Bar chart, because there I don't know what X-field and Y-field to be given.

1) how can I pass this array to Bar
chart or column chart.
The dataProvider property of the charts is an object. So you can send anything you want in there. I would expect it to handle an array just as well as it would handle an ArrayCollection.
That said, I believe you're going to have to send in objects with data properties that represent the xField and yField values. An array of simple values doesn't give the component enough information to know what to do.
2) how do I need to show months on
Xaxis. beacuse I'm asking this
regarding, I have kept a filters that
even if we want to see some months or
a particular months or perticalar span
of months... there on Xaxis it need to
change the months dynamically
depending on the filters..... (for ex,
on Xaxis the values should be (Jan,
Apr, Jun,Oct) if i select the 3 months
period filter....)
I believe if you create objects, as I stated before with the Xfield value being a string representing the month and a y field value representing your data point, the graph should know how to display the values.
If you were using an ArrayCollection you could easily use the collection's filtering abilities to change the dataProvider, which I would expect would change the graph.
More docs on this

Related

Dash RangeSlider tooltip to use custom value instead of raw value (similar to marks)

Suppose I'm using a RangeSlider as a date filter so the RangeSlider essentially picks the index of a list of dates. I can mostly adapt to this by using the marks parameter to map the value to strftime of the aforementioned list. My marks are limited to years but I want to be able to select months by using the tooltip. However the tooltip only takes 2 dict values, neither of which amend the output similar to how we can do in the marks.
from dash import dcc
daterange=[(datetime(1900,1,1).date() + timedelta(days=x))
for x in range((datetime(2023,2,1).date()-datetime(1900,1,1).date()).days)
if (datetime(1900,1,1).date() + timedelta(days=x)).day==1 and
(x==0 or (datetime(1900,1,1).date() + timedelta(days=x))>datetime(2010,1,1).date())]
dcc.RangeSlider(min=0, max=len(daterange), step=1,
value=[0, len(daterange)],
marks={x:daterange[x].strftime("%Y") for x in range(len(daterange))
if daterange[x].month==1 or x==0 or x==len(daterange)},
vertical=True, tooltip={'placement':'right', "always_visible": False},
id='quefilter')
This looks like this:
I'd like to be able to set the tooltip to daterange[x].strftime("%Y-%m") so instead of saying 138 it'd say 2021-07
I realize that DatePickerRange exists but I like how quickly a RangeSlider can be changed.

Remove duplicate values on x axis for chart js

I have got an X axis and it has the months displaying. However for the month of august it is displaying twice...I am not to sure why that is. I would like to remove the duplicated Aug-2020 on the x Axis.
Here is a coding sandbox I created to show what I mean.
I don't know what you're trying to achieve but in your app.js file change maxTicksLimit: 5, to maxTicksLimit: 2, and it will change to single value for Aug.
You have to calculate the chart before plotting.

SSRS Hide one legend from each series

I've been looking around at SO and Google but not really found anything that matches my current problem.
I'm making a stacked barchart based on two series. One series shows late, outstanding issues and one shows only outstanding (still within the due date).
The problem is that my legend shows four individual items, whereas I only want two (one for each series).
I've attempted by adding this in the Series Properties>Legend>Do not show this series in a legend formula (fx):
=IIF(Fields!ReadyForWork.Value = 1, False, True)
This basically checks to only display the legend if the value is 0. However this hides both the items in the legend, not just the one.
The relevant data I'm working with right now is:
TRK_Feature_LKID (basically each row's PK)
DateToBeActioned (important for maroon) - Used to determine if Date.Now() is higher to a set date when the issue should have been resolved.
ReadyForWork - A numeric value (0 / 1) to see if the item is ready for work.
AcountablePerson - The name of the responsible person (x-axis).
In below image I want to remove the red 'Late Issue' and the maroon 'True - ReadyForWork'.
So I managed to fix this by adding a separate field in the report's dataset that basically checked whether the DateToBeActioned was outside of GETDATE:
CASE
WHEN DATEDIFF(day, [DateToBeActioned], GETDATE()) >= 0 THEN 1
ELSE 0
END as 'Outstanding'
And by using that field in the legend as well as specifying that the dataset should only retrieve issues that had not been completed:
WHERE ReadyForWork = 0
I was able to set the legend to only show the two preferred items.
So for anyone who might face a similar issue; one way of fixing it might be to have a seperate field in your dataset that checks the case that checks for the parameters you don't want / you want to show in the legend.

ShieldUI Stacked Bar Graph with Totals

I've got a stacked bar graph that shows two categories of information. Now I have a requirement to show the total of the bars at the end of the bar. I've attached a mock-up showing what I'm trying to do -- the numbers in red are what I'm trying to add.
(source: michaelandlisa.us)
I couldn't find anything in the documentation on how to add totals, or on how to add annotations (which would also work).
Basically, ShieldUI jQuery chart plugin renders the series without text, as shown here.
To alter this behavior, you need to first enable the text.
Then, you can use a format function to either show some cumulative text, or return an empty string. More information on this approach is available here.
This can be coupled with a global counter to determine each Xth iteration.
I managed to get this to work by adding a Scatter chart of total values on top of the existing bar chart.
http://michaelandlisa.us/Images/Forums/stacked_with_totals_scatter.png
I also set the color on the series to "transparent" so the point wouldn't show up, and then I bumped the X and Y by 15 and 12 respectively. I also set the style to Bold, and set the format to "{point.y:n0}". Here's the relevant MVC code (where totals is a List of object):
.DataSeries(series => series.Scatter()
.Data(totals)
.CollectionAlias("Total")
.Color("transparent")
.AddToLegend(false).DataPointText(dtp =>
{
dtp.Enabled(true);
dtp.Format("{point.y:n0}");
dtp.Style(s => s.FontWeight(FontWeight.Bold));
dtp.Color("red");
dtp.X(15);
dtp.Y(12);
}))

JFreeChart BarChart - CategoryDataset - multiple values for a series within a category

Do you know if it is possible to have a BarChart similar to the one on the image below, but with several bars for the same series in each category ?
By that, I mean to have, for instance, 3 "First", 3 "Second", and 3 "Third" bars in each category, each of these bars with a different value.
With the DefaultCategoryDataset, this is not possible : if you add more than one value for a series in a specific category, only the last value is taken into account.
I have also tried adding multiple values for a series with the DefaultMultiValueCategoryDataset class, but this does not do what I want. For instance if you do this :
DefaultMultiValueCategoryDataset defaultMultiValueCategoryDataset = new
DefaultMultiValueCategoryDataset();
List<Double> vals11 = Arrays.asList(8.5D, 10.9D, 12.2D);
defaultMultiValueCategoryDataset.add(vals11, "First", "Category 1");
you get in the first category one bar of the series "First", whose value is actually the mean of the three values 8.5, 10.9 and 12.2. I would like three separate bars instead.
I have searched for several hours and asked on JFreeChart's forums, but they are not very active, unfortunately. Thanks
(source: java2s.com)
Are you using Java persistence? I solved this by setting the #ID annotation in the Java class on two fields. This allowed JFreeChart to determine the products had the same name but different sizes and therefore to treat them as two separate entries. Sorry I don't have any examples to show you, the data is somewhat confidential.

Resources