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

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

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.

SAPUI5 Googlemaps library : multiple markers via list

i'm using the SAPUI5 Googlemaps library. It works great for one marker, but i need to add multiple markers based on a list. How can i add all these items to the map ?
<Map height="500px" zoom="10" lat="52,03838" lng="5,67866">
<markers> --> add items="{/GmapMarkers}" ????
<Marker lat="{lat}" lng="{lng}" info="{info}" />
</markers>
</Map>
Based on the items in /GmapMarkers i want to fill the map.
Is this possible ?
gr
Hans
I think you can use aggregation binding. Here is the example from http://jasper07.secondphase.com.au/openui5-googlemaps/. Look for Marker cluster.
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:gmaps="openui5.googlemaps" controllerName="sampleController">
<gmaps:Map lat="33.408495" lng="-104.521889" width="950px" height="475px" zoom="4" zoomControl="true">
<gmaps:markerCluster>
<gmaps:MarkerCluster markers="{/features}">
<gmaps:markers>
<gmaps:Marker lat="{geometry/coordinates/1}" lng="{geometry/coordinates/0}" info="{properties/city}" icon="http://www.w3schools.com/googleapi/pinkball.png"></gmaps:Marker>
</gmaps:markers>
</gmaps:MarkerCluster>
</gmaps:markerCluster>
</gmaps:Map>
</mvc:View>

How to hide ApplicationIBarIcons on pivot's selectionchange

I have a Pivot and 5 Pivot items inside it, by an xml I am adding and removing those pivot items as per the need but the thing is I want some of my ApplicationBarIcons visible on selection of certain pivotitems and collapse on certain pivotitems view,I cannot do this by the help of checking selectedindex because dynamically they are getting changed. How can I do it?
Not sure how you are handling the loading of the app bar. Are you doing in the the XAML code or C#?
If you are doing it in C#, there should be a Visible property for the ApplicationBar object.
Be sure to check out the Cimbalino toolkit for windows phone! It has a bindable application appbar, so you can tweak the IsVisible property when you switch through the pivots! > There is a SelectionChanged event on the Pivot to track what pivot is currently active, I would check the Name of the pivot or a Tag like Techloverr suggests
Example cimbalino http://code.msdn.microsoft.com/wpapps/cimbalino-windows-phone-4de77988
You can create ApplicationBar for certain pivot items of pivot page like this using id.If id =0,it will take automatically pivot Page(Item) 0 .By using this,you can choose which all AppBars has to be in whole pivot pages and in selective pivot pages(Items).
<phone:Pivot>
<i:Interaction.Triggers>
<appBarUtils:SelectedPivotItemChangedTrigger>
<appBarUtils:SelectedPivotItemChangedTrigger.SelectionMappings>
<appBarUtils:SelectionMapping SourceIndex="0" TargetIndex="0"/>
</appBarUtils:SelectedPivotItemChangedTrigger.SelectionMappings>
<appBarUtils:SwitchAppBarAction>
<appBarUtils:AppBar Id="0" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
</appBarUtils:AppBar>
<appBarUtils:AppBar Id="1" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
</appBarUtils:AppBar>
<appBarUtils:AppBar Id="2" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.home.png" Text="home" Command="{Binding HomeNavigationCommand}"/>
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.money.png" Text="collection" Command="{Binding CollectionPageCommand}"/>
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.check.rest.png" Text="ok" Command="{Binding OrderConfirmationButtonCommand}"/>
</appBarUtils:AppBar>
<appBarUtils:AppBar Id="3" BackgroundColor="{StaticResource AppBarBg}" ForegroundColor="{StaticResource Foreground}">
<appBarUtils:AppBarButton x:Name="ConfirmationAppBarButton" IconUri="/Assets\Images\appbar.cancel.rest.png" Text="cancel" Command="{Binding OrderCancelButtonCommand}"/>
<appBarUtils:AppBarButton IconUri="/Assets\Images\appbar.check.rest.png" Text="ok" Command="{Binding OrderConfirmationButtonCommand}" IsEnabled="{Binding Model.EnableCheck,Mode=TwoWay}" />
</appBarUtils:AppBar>
</appBarUtils:SwitchAppBarAction>
</appBarUtils:SelectedPivotItemChangedTrigger>
</i:Interaction.Triggers>
</phone:Pivot>
//Assuming your views are in View Folder
Use AppBarUtils from here and refer in code.
You can have different appbars for each pivot item using the above sample code.Hope this will help you.

Difficult with LineChart

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