Line chart with fixed y-axis? - actionscript-3

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.

Related

div automatic height is too small for content

I have a situation where I have a report that is normally displayed in a jsp, and now I have a print where those multiple instances of said page needs to be included multiple times, so this is a combined report kind of thing. To circumvent issues that would arise from adding values to the model with the same key we came up with this way to include the jsp.
<c:forEach var="prodTest" items="${listProductionTest}">
<div style="display:block" id="chargeReport${prodTest.report.recId}">
</div>
<script type="text/javascript">
$.get("ChargeReportContent?recId=${prodTest.report.recId}", function( data ) {
$("#chargeReport${prodTest.report.recId}").html(data);
});
</script>
ChargeReportContent is an endpoint that returns the jsp with the values. It retrieves data correctly however the divs height is all wrong causing the both reports to overlap. It seems auto height gives itself enough height to only include the first part of the report.
display block doesnt seem to work. These reports should each have size of around 1500px but putting the height as a fixed value is not really an option as the size can change depending on the report or updates.
Plz help!
what's the position of the elements inside the div?
Make sure they are not fixed, absolute or have float set.
Divs are set to display block by default, you might try to set it to flex
A colleague suggested that this is because the html was filled programmatically, the size was not accurate. We never figured out a clean way to fix this, but the best we came up with is to calculate the needed height ourselves and then set it. For example
the title is always 92px, recipe is always 256px, Reportlines size= 42+(21(materials+1)), notes part is 23px if there are no notes, 42 if there is a note, etc.
if in the JSP we could not easily retrieve a number of Alarms we made an invisible input to store the value and is added by the model like
<input id="alarmCounter${report.recId}" style="display: none" value="${alarmCount}"></input>
and then we retrieve the val to use it in the calculation.
After we find the total we just set it in the get that gets the included page
$.get("ChargeReport?recId=${prodTest.report.recId}", function( data ) {
$("#chargeReport${prodTest.report.recId}").html(data);
let alarmCount = 0;
alarmCount =parseInt($('#alarmCounter${prodTest.report.recId}').val());
var chartsize = 400*($('#chartExists${prodTest.report.recId}').val() == 'true' ? 1 : 0)
var pixelsNeeded= 92 + 256 + 205
+ 42+ 21*(${fn:length(prodTest.report.reportLines)}+1)
+ 21*(alarmCount+2)
+19+24*${!empty prodTest.report.comment}
+ chartsize + 51
+50;
$('#chargeReport${prodTest.report.recId}').css("height",pixelsNeeded+"px");

how to add line chart in October CMS?

I want to add a line chart as a control chart in one of the widget pages in October CMS. CMS has pre-built classes for bar chart and pie chart. I was wondering if they have similar classes for other kind of analytics data.
I want to add the line chart prebuilt class to an html partials page, that can be used as a widget in october cms.
It seems that you are talking about things like this: https://octobercms.com/docs/ui/chart and you are looking for another type of chart besides those mentioned there.
I wanted to say if such a thing is not listed there then probably it does not exist. But... hey... I just went looking into the backend UI JS code.
Look at this file in your October app root: {% app root %}/modules/system/assets/ui/js/chart.line.js
/*
* Line Chart Plugin
*
* Data attributes:
* - data-control="chart-line" - enables the line chart plugin
* - data-reset-zoom-link="#reset-zoom" - specifies a link to reset zoom
* - data-zoomable - indicates that the chart is zoomable
* - data-time-mode="weeks" - if the "weeks" value is specified and the xaxis mo
de is "time", the X axis labels will be displayed as week end dates.
* - data-chart-options="xaxis: {mode: 'time'}" - specifies the Flot configurati
on in JSON format. See https://github.com/flot/flot/blob/master/API.md for detai
ls.
*
* Data sets are defined with the SPAN elements inside the chart element: <span
data-chart="dataset" data-set-data="[0,0],[1,19]">
* Data set elements could contain data attributes with names in the format "dat
a-set-color". The names for the data set
* attributes are described in the Flot documentation: https://github.com/flot/f
lot/blob/master/API.md#data-format
*
* JavaScript API:
* $('.chart').chartLine({ resetZoomLink:'#reset-zoom' })
*
So the functionality is there, it seems, but it's not in the public docs. Looks like you could try out something like this
<div
class="control-chart"
data-control="chart-line"
style="min-height:400px"
data-zoomable="1"
data-reset-zoom-link="#reset-zoom"
data->
<span data-chart="dataset" data-set-label="Graph me tender" data-set-data="[0,0],[1,5],[3,8],[4,2],[5,6]">
Graph me tender
</span>
<span data-chart="dataset" data-set-label="Graph me sweet" data-set-data="[0,0],[1,5],[3,8],[4,2]">
Graph me sweet
</span>
</div>
<a id="#reset-zoom" href="#">Reset zoom</a>
(Edit: There was a somewhat "dirty" tweak necessary here: I added a min-height css attribute, otherwise there was an error thrown. Maybe there should be some additional class for that instead which I do not know. Also, the two data-sets are not plotted in order (the second is plotted first) and are wrongly labeled in the legend, and appear horizontally connected to each other. The zoom function does not seem to work, etc, etc. I think this line graph thingy is possibly still work in progress and that might be the reason why it is not included in the docs yet. )
, play around with it and see what it does. (I have not tested this and hope it works somehow.) If I understand correctly it should give you a zoomable line graph with data points [0,0],[1,5],[3,8],[4,2],[5,6] (x,y coordinate points) and the link below should reset the zoom (edit: zooming does not work. maybe need to set some additional options for that)
The whole thing seems to be based on this Flot JQuery chart library. So you might find some good further hints there or here, besides reading October's {% app root %}/modules/system/assets/ui/js/chart.line.js source code.

Show a threshold line in Flex Chart

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>

Extending axis with Google Charts

My question
I am trying to extend the Y-axis so it is counting to 300 instead of 100.The problem is that when I change the Y-axis to count to 300, the values are staying on the same place as when it is counting to 100.So for example if the value on X2 is 10, then it will be displayed as 10 if my Y-axis is counting to 100. But if it is counting to 300, it will be displayed as 30.
Hopefully the problem is clearly described. If you have any questions, feel free to ask them.
My code
<img src="http://chart.apis.google.com/chart?chxt=x,y&chs=440x220&cht=lxy&chco=3072F3,FF0000&chd=t:0,1,2,4,5,6,7,20|10,20,300,250,150,70,90,40|1,5,9|50,60,70&chdl=Unique Players|Average playtime&chdlp=b&chg=5,60,0,29&chls=2,4,1|1&chma=5,5,10,25&chxr=0,0,100|1,0,300" width="440" height="220" alt="" />
I have found out that it didn't work because I forgot to set the chds parameter.
chds
A set of one or more minimum and maximum permitted values for each data series, separated by commas.

SSRS: Snapshot runtime?

I have a SSRS report which is the snapshot or another report. It runs every day # 6 am. I want to add a header at the top of the report(snapshot), which indicates when the snapshot was taken so that the user knows when the snapshot was taken.
Does anyone know how can i do that?
if I truly understand your question :
you can add date or time of report processing by adding a textbox on header and write this expression as its value :
=TimeOfDay()
or
=Now()
Ususally you would use Globals!ExecutionTime to display this, but from my research, headers and footers are calculated when the report is rendered. A work around for this is to place the textbox (make it hidden) with Globals!ExecutionTime in it on the report body and then place another textbox in the header or footer which references that textbox like this: ReportItems!ReportBodyTextBoxName.Value.
Answer found on the following site:
http://www.manning-sandbox.com/message.jspa?messageID=52186
The best way for me was to add an extra column to my dataset. e.g.:
SELECT COL1
,COL2
,...
,COLn
,SYSDATE AS EXEC_DAT
FROM ...
You can then use First(Fields!EXEC_DAT.Value, "DATASET_NAME") if the expression is in the header.
PS: SYSDATE works for Oracle, you'll have to determine the correct function for your RDBMS