Difficult with LineChart - actionscript-3

I need help about LineChart:
Situation:
I have a LineChart with some data acquired by Oracle query, I have in select the columns ValorC, ValorP, Sla and OBS, where OBS="Justification if some problem occurred in ValorC". The problem is How can I show this value when put mouse over the point (value) in chart ? I can work with DataTip?
<mx:series>
<mx:LineSeries id="IDValor" displayName="Execução Diária" yField="ValorC" showDataEffect="seriesInterpolate" />
<mx:LineSeries id="IDValorP" displayName="Meta Produção" yField="ValorP" showDataEffect="seriesInterpolate" />
<mx:LineSeries id="IDSLA" displayName="Sla Acordado" yField="Sla" showDataEffect="seriesInterpolate"/>
</mx:series>

I resolved the problem with two funcions:
- 1º
public function init():void { chart.addEventListener(ChartItemEvent.ITEM_ROLL_OVER, minhaSolicitacao); }
- 2 º
public function minhaSolicitacao(e:ChartItemEvent):void { TextObs.text = e.hitData.item.OBS; }
*OBS are visible=false TKS for ALL

Related

How to create a custom system field in magento 1?

Magento 1.9
I want to create a new tab in System > Configuration.
In this tab, I need a group tab and in this group tab i want a textarea which is connected to a field of my database. If i edit my textarea, it will modify my database field too.
Look at this: https://prnt.sc/orwph1
I don't know how to connect my textarea with my db.. Create a new tab with a new group it's easy but connect it to the db..
Thanks!
let's assume you want a section that has 2 fields: multiselect, text area. In the multiselect you have all your customer and in the text are you get the modify to apply for a certain db field (related to the customer).
your system.xml should me something like this:
<config>
<tabs>
<admin_customTab_2 translate="label" module="sections">
<label>- TAB NAME -</label>
<sort_order>2</sort_order>
</admin_customTab_2>
</tabs>
<sections>
<customsection2 translate="label" module="sections">
<label>label name</label>
<tab>admin_customTab_2</tab>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<block translate="label">
<label>label name</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<block_customers>
<label>Select user</label>
<comment>user list</comment>
<frontend_type>multiselect</frontend_type>
<backend_model>sections/users</backend_model>
<source_model>sections/users</source_model> <!-- adding a source-model for the form's select -->
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</block_customers>
<block_textarea>
<label>changes to apply</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</block_textarea>
</fields>
</block>
</groups>
</customsection2>
</sections>
this is not enough for the configs, you need to tell Magento about the access control list (ACL) or admin-users will not see it. It is done in the config.xml
like this:
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<customsection2>
<title>Customer Changes?</title>
</customsection2>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
all is setted, but doing nothing but showing us the tabs and forms.
If you was brave enough you noticed a tag in the system.xml code up here,
<backend_model>sections/users</backend_model>
<source_model>sections/users</source_model> <!-- adding a source-model for the form's select -->
this tell magento that you are using a model relating to this form, where you can do operations.
So, in your Model's path create the (in this example) User.php
and here we go:
you want to extend your custom class with this one.
class Admin_Sections_Model_Users extends Mage_Core_Model_Config_Data
yes but we still didn't insert any data in the form.
You can do this by just adding a special function toOptionArray() :
public function toOptionArray()
{
$collections = Mage::getModel("customer/customer")->getCollection();
foreach ($collections as $colletion){
$user = Mage::getModel("customer/customer")->load($colletion->getId());
$array[] = array('value'=>$user->getEntityId(),'label'=>Mage::helper("sections")->__($user->getName()));
}
return $array ;
}
this will set ALL the customer's name into the multi-select form.
"yeah, nice.. I asked about the text-area"
before telling you how to get Data from Store Configs, you should know that there are 2 main methods for elaborating the form data:
public function _afterSave()
{}
public function _beforeSave()
{}
in there you can put all your code, no need to explain what is the difference between them.
in this function you can easy get the Data from Store Config by doing:
$text_area_string = Mage::getStoreConfig('customsection2/block/block_textarea');
"yeah nice... but my main problem is to save things in DB"
you can use whenever you prefer the Mage::getModel('') method , this can connect you to the database. Lets make an example; modify the 'is_active' field on 'customer_entity' table.
$customer = Mage::getModel("customer/customer")->load($customer_id);
$customer->setData("is_active",0);
$customer->save();
this field doesn't do really anything, it is just a very fast example.
This should let you do what you are aiming for.
If something sounds strange, please let me know!

How to find ArrayList length after filtered in apache royale

This code snippet is from TDJ List
<j:Card>
<html:H3 text="Jewel List"/>
<j:List id="list" width="200" height="300" dataProvider="{simple}" change="onChange(event)"/>
<j:TextInput width="200">
<j:beads>
<j:TextPrompt prompt="filter list..."/>
<j:SearchFilterForList list="{list}"/>
</j:beads>
</j:TextInput>
<j:Label id="selected" html="{describeItem(list.selectedItem)}"/>
</j:Card>
There is j:SearchFilterForList
What i want to know is when its work (type some text on the filter textbox), how to find filtered list length?
Thankyou
Just use the new "length" property just recently added. Tour de Jewel was updated as well showing the use of this new bead property in the List examples.
<j:Label html="{'list filtered length: ' + filter.length}"/>
<j:TextInput>
<j:beads>
<j:TextPrompt prompt="filter list..."/>
<j:SearchFilterForList id="filter" list="{iconList}"/>
</j:beads>
</j:TextInput>
Notice that the filtering performed by this bead is only visual, and the underlaying dataProvider is not filtered itself. To get a filtered view of the dataProvider you should use ArrayListView API, that is similar to flex ListCollectionView with filterFuncion.

Displaying multiple xml information in html via ajax

I have the AirPlayHistory.xml file that shows the last 3 streamed songs and is updated every time the song changes..
AirPlayHistory:
<Event status="happened">
<Song title="Forbidden Voices">
<Artist name="Martin Garrix" ID="344518"> </Artist>
<Info StartTime="11:06:31" JazlerID="7235" PlayListerID=""/>
</Song>
<Song title="Faded">
<Artist name="Alan Walker" ID="343769"> </Artist>
<Info StartTime="11:10:28" JazlerID="7769" PlayListerID=""/>
</Song>
<Song title="Afterlife">
<Artist name="Illenium" ID="344414"> </Artist>
<Info StartTime="11:13:30" JazlerID="10668" PlayListerID=""/>
</Song>
</Event>
I have this code:
var speed = 10000; // 10 seconds
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
ajax={};
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e) {try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.get=function(url,func){ajax.send(url,func,'GET')};
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
ajax.submit=function(url,elm,frm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
function process(xml) {
document.getElementById('contentfile').innerHTML=xml;
var title = document.getElementById('contentfile').getElementsByTagName('Song')[0].title;
var name = document.getElementById('contentfile').getElementsByTagName('Artist')[0].name;
document.getElementById('contentfile').innerHTML='NOW ON AIR: '+name+' | '+title;
}
function checkXml() {
ajax.get('http://website.com/jazler/NowOnAir.xml',process)
}
window.onload=function() {
checkXml();
tId=setInterval('checkXml()',speed)
}
<div id="contentfile">
but he shows only one song of 3..
Clear! you have the first only you write name and title!! you simply rewrote the innerHTML BUT code line document.getElementById('contentfile').innerHTML=xml; is not good you have to loop through! now you write all inner.HTMl content with the first element title[0] name[0]

BIML: automatic creation of OleDbDestinations for XMLSource in Dataflow

I'm having a XML file with 2 outputpaths and 2 tables in my staging DB. Tables and outputpaths do have same names.
Instead of writing 2 times OleDbDestination and changing Inputpath and ExternalTableOutput I would like to use some Bimlscript.
My current solution:
<Dataflow Name="DF_MyXml">
<Transformations>
<XmlSource Name="MyXml">
<FileInput ConnectionName="simple.xml" />
<XmlSchemaFileInput ConnectionName="simple.xsd" />
</XmlSource>
<OleDbDestination Name="Database" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.Database" />
<ExternalTableOutput Table="Database" />
</OleDbDestination>
<OleDbDestination Name="Project" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.Project" />
<ExternalTableOutput Table="Project" />
</OleDbDestination>
</Transformations>
</Dataflow>
What I would like to achive:
<Dataflow Name="DF_MyXML">
<Transformations>
<XmlSource Name="MyXml">
<FileInput ConnectionName="simple.xml" />
<XmlSchemaFileInput ConnectionName="simple.xsd" />
</XmlSource>
<#foreach (var OutP in ["myXML"].DataflowOutputs) { #>
<OleDbDestination Name="<#=OutP.Name#>" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.<#=OutP.Name#>" />
<ExternalTableOutput Table="<#=OutP.Name#>" />
</OleDbDestination>
<# } #>
</Transformations>
</Dataflow>
Sadly this isn't working. ;-)
In API-Documentation for AstXMLSourceNode I found the property "DataflowOutputs" which "Gets a collection of all dataflow output paths for this transformation" (sounds promising, uhh?) but I can't even figure out how to reference the XMLSource in Bimlscript in any way.
Starting from RootNode I was able to find my Dataflow-Task but then I got stuck and didn't manage to "find" my Transformations\XMLSource.
Any help would be much appreciated!!
BTW: if there is a solution to automatically create destination-tables based on a given XSD this would be greate too. :-)
You need to make sure your connections are declared in a separate file to be easily accessed in Biml script. You can mess with Console.WriteLine() to print out details about objects to the output window and get a glimpse of what is going on in the BimlScript.
In the second file, traditionally called Environmnet.biml,
you need (only with your xml file connection info, the data here is just a placeholder):
<Connections>
<FileConnection Name="XmlFile" FilePath="C:\test\XmlFile.xml" RelativePath="true" />
<FileConnection Name="XmlXsd" FilePath="C:\test\XmlXsd.Xsd" RelativePath="true" />
</Connections>
then you can do something to the effect of :
var fileConnection = RootNode.Connections["XmlFile"];
(sorry before I accidentally put DbConnections)
and play with it from there. I do not have any xml files at my disposal right now to play around with to help you get the exact information that you are looking for. I will update on Monday.

Barchsrt series donot show data when I change series name and data provider?

I create my bar chart as following:
{axisStroke}
{axisStroke}
{axisStroke}
<!-- horizontal axis -->
<mx:horizontalAxis>
<mx:LinearAxis id="ac" baseAtZero="true"/>
</mx:horizontalAxis>
<!-- horizontal axis renderer -->
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{ac}"
canDropLabels="true"
styleName="wsViewAxisLabel"
minorTickPlacement="none"
tickPlacement="none"
labelGap="0"
showLabels="false"
showLine="false">
<mx:axisStroke>{axisStroke}</mx:axisStroke>
<mx:tickStroke>{axisStroke}</mx:tickStroke>
<mx:minorTickStroke>{axisStroke}</mx:minorTickStroke>
</mx:AxisRenderer>
</mx:horizontalAxisRenderers>
<mx:series>
<mx:BarSeries id="barSeries" color="#FFFFFF" labelAlign="right"
displayName="{seriesName}"
filters="{[new DropShadowFilter(2,45,0,.3)]}" fontSize="11"
fontWeight="bold" labelField="{valueName}"
xField="{seriesName}"
showDataEffect="{interpolateIn}"
yField="{categoryName}">
<mx:fill>
<mx:LinearGradient id="linearGradient">
<mx:entries>
<fx:Array>
<mx:GradientEntry color="0x99ffcc"
ratio="0.0"
alpha="0.1" />
<mx:GradientEntry color="0x99ffcc"
ratio="1.0"
alpha="1.0"/>
</fx:Array>
</mx:entries>
</mx:LinearGradient>
</mx:fill>
</mx:BarSeries>
</mx:series>
<mx:annotationElements>
<mx:CartesianDataCanvas id="mCanvas"/>
</mx:annotationElements>
</mx:BarChart>
but when I change the series name and datacollection. the bar chart did not show data.
I try to debug code and find the barseries's items length is 0. it's dataprovider and series name, xfield, yfield is right. do not know why barseries did not create barseriesitems.
many thanks for help.
thanks
The dataProvider is bound to the original name, so the dataProvider assignment to the ID needs to be updated. The dataProvider is bound the the ArrayCollection, so the ArrayCollection assignment to the dataProvider needs to be updated as well.
References
Flex Mobile Performance Checklist