Show a threshold line in Flex Chart - actionscript-3

I am stuck with a requirement to display a horizontal line on a ColumnChart to indicate a threshold level. I have the data to the Chart as an ArrayCollection.
So my question here : Is it possible to get the location of a value that is shown on the y axis? I think I will be able to place a line or 1px high canvas on top of the Chart to achieve this. Or better, is there any built in functionality that i may have overlooked or is there some open library that can achieve something like this?

The easiest solution is to add a LineSeries to your chart which has the same value on the Y-axis for each item on the X-axis.
Your dataprovider could be produced as follows, with the column chart using "result" for its yField and the line chart using "threshold" as its yField.
<dataset>
<dataitem>
<time>16:00</time>
<result>170</result>
<threshold>350</threshold>
</dataitem>
<dataitem>
<time>17:00</time>
<result>430</result>
<threshold>350</threshold>
</dataitem>
<dataitem>
<time>18:00</time>
<result>250</result>
<threshold>350</threshold>
</dataitem>
</dataset>

Related

Altair SchemaValidation Error When Faceting

I have this dataframe:
And I want to make a horizontal stacked bar chart that displays the same information as this chart:
I have generated this code:
chart = alt.Chart(df_q4).mark_bar().encode(
x = alt.X('value:Q', axis=None),
color=alt.Color('color_code:N', scale=None),
).facet("title:N"
).properties(
width=400,
height=700)
chart
However it throws this error:
SchemaValidationError: Invalid specification
altair.vegalite.v4.api.Chart, validating 'required'
'data' is a required property
alt.FacetChart(...)
I am not sure why I cannot facet. I have also tried encoding the facet object within the chart encoding, and that did not work as well.
I also would like to incorporate some code into my chart that shows only the titles, colors, and values pertaining to a specific season. This will be via wrapping the code within a function that's something like:
define color_palette(season):
Facet charts do not support width or height properties. Perhaps you meant this?
chart = alt.Chart(df_q4).mark_bar().encode(
x = alt.X('value:Q', axis=None),
color=alt.Color('color_code:N', scale=None),
).properties(
width=400,
height=700
).facet(
"title:N"
)

SSRS - Multiple font or color within a chart item

I'm using Report Builder 3.0. Long story short, I want to make the font bold for the text in the red box that you see in the image below:
Basically, it's just one expression in the legend field of my value, however, for clarity's sake (for my end users) I wish to make the "title part" bold. I found the following solution for textboxes in a tablix using Html by checking off the "HTML – Interpret HTML tags as styles." checkbox within the Textbox's properties. (http://www.sqlchick.com/entries/2010/10/31/using-different-formats-within-a-single-textbox-in-ssrs.html)
However, I can't find anything similar for graphs! I mean if MS thought about it for tables, I presume they must've given it some thought for a chart setting too.
Thanks to all!
p.s. As an aesthetic solution to my problem, I did think of simply creating a new title field, moving it to the exact same location and formating it. But I'm surious whether there'd be some more "proper" way of doing this.
I'm using the same approach for one of my charts.
STEPS.
Select the Chart series to open property pane. In my case, the chart series name is TWR Chart Series
Select the color property and select to build the expression.
I'm posting one of my expression. You can build your own expression base don your field names etc.
=IIF(Fields!ProductID.Value = 1 OR Fields!ProductID.Value = 6,"#00425E",
IIF(Fields!ProductID.Value = 3 ,"#6B8797",
IIF(Fields!ProductID.Value = 5 OR Fields!ProductID.Value = 7,"#799179",
IIF(Fields!ProductID.Value = 4 AND Fields!sort.Value=99,"#6bb1be","#48597B"))))
If used sensibly, you should get your desired results.Good luck.

SSRS 2005 Conditional Formatting for a Bar Graph?

Afternoon all,
I have a simple bar graph in SSRS 2005. I wish to apply some conditional formatting to this bar graph but i am unable to get this working.
I believe that i should be able to add formmatting within the 'Chart Properties --> 'Data' tab --> 'Values' section? I have added the following code to the Expression editer but this doesnt work. when i preview the report it shows the bar graph colour as green as this is the default pallette?
=IIF(fields!Value.Value <=129, "blue", "yellow")
I have also tried to add this to the 'Format' property of the chart but i am still unable to see this formatting.
Am i missing something? Can anyone suggest a working solution or another method?
Regards
Betty
Should work OK? I replicated by setting an expression under Data Field -> Properties -> Appearance -> Series Style -> Fill -> Color.
=IIf(Fields!val.Value < 150, "Red", "Blue")
So something like:
Final result:
Only other consideration is that, depending on your underlying data, you might need an aggregate in the expression:
=IIf(Sum(Fields!val.Value) < 150, "Red", "Blue")
But you can see that it should be possible.

Line chart with fixed y-axis?

I'm trying to have a line chart with a fixed y-axis. that is, I have values that are mostly between 30 and 70, but I'd like to have the chart y-axis as a constant between 0 and 100 so it wouldn't resize as new values are coming in (if they happen to be larger than previous values).
How'd I go about doing this?
Set minimum and maximum properties of LinearAxis. Something like this:
<mx:verticalAxis>
<mx:LinearAxis title="title" displayName="displayName" maximum="100" minimum="0"/>
</mx:verticalAxis>
And don't you want to give a try to existing classes? :)
Yahoo's Astra pack
http://developer.yahoo.com/flash/astra-flash/charts/using.html
Or you may post some sample code so we can see what should be modified.

Matplotlib/Pyplot: How to zoom subplots together?

I have plots of 3-axis accelerometer time-series data (t,x,y,z) in separate subplots I'd like to zoom together. That is, when I use the "Zoom to Rectangle" tool on one plot, when I release the mouse all 3 plots zoom together.
Previously, I simply plotted all 3 axes on a single plot using different colors. But this is useful only with small amounts of data: I have over 2 million data points, so the last axis plotted obscures the other two. Hence the need for separate subplots.
I know I can capture matplotlib/pyplot mouse events (http://matplotlib.sourceforge.net/users/event_handling.html), and I know I can catch other events (http://matplotlib.sourceforge.net/api/backend_bases_api.html#matplotlib.backend_bases.ResizeEvent), but I don't know how to tell what zoom has been requested on any one subplot, and how to replicate it on the other two subplots.
I suspect I have the all the pieces, and need only that one last precious clue...
-BobC
The easiest way to do this is by using the sharex and/or sharey keywords when creating the axes:
from matplotlib import pyplot as plt
ax1 = plt.subplot(2,1,1)
ax1.plot(...)
ax2 = plt.subplot(2,1,2, sharex=ax1)
ax2.plot(...)
You can also do this with plt.subplots, if that's your style.
fig, ax = plt.subplots(3, 1, sharex=True, sharey=True)
Interactively this works on separate axes
for ax in fig.axes:
ax.set_xlim(0, 50)
fig.draw()