Radar charts


Run Time Radar Data


[ritsrivastava said:]
Hi, i have gentated Xml at run time from my slection window, at first when i have not made any selctions(countries, Indicators) then it(Radar) load default values and it is working fine, but when i will do some selection(countries and indicators) from my 'selction window' and hit on apply btn then i will send the fresh XML Data to Radar chart, but it will give the error, but if i have saved the same XML dand load it is wokring fine. I dont know why Radar chart is not genrated when i passed the XML at second time , and it will genrate the Radar chart if i passed the same XML at first time( first Loaded time)???? My code is given below ::::
// ActionScript file
//import Controls.userSelectionCntrl.userSelection;
import flash.events.MouseEvent;
import flash.net.SharedObject;
import ilog.charts.chartClasses.RadarSeries;
import ilog.charts.series.RadarColumnSeries;
import ilog.charts.series.RadarLineSeries;
import mx.charts.renderers.CircleItemRenderer;
import mx.collections.ArrayCollection;
import mx.containers.ControlBar;
import mx.containers.TitleWindow;
import mx.containers.VBox;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.Menu;
import mx.core.IFlexDisplayObject;
import mx.events.CloseEvent;
import mx.events.MenuEvent;
import mx.graphics.IStroke;
import mx.graphics.Stroke;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
private var uStroke:IStroke;
private var usStroke:Stroke;
// Variable Declaration
[Bindable] public var defaultSettingsXML:XML =new XML();
[Bindable] public var appSettingsXML:XML;
[Bindable] private var dataSource:ArrayCollection= new ArrayCollection();
[Bindable] private var categories:Array;
[Bindable] private var countries:Array=[];// new Array(["india","pakistan","china"]);
[Bindable] private var numVisibleSeries:int = 0;
[Bindable] public var numSelectedSeries:int = 0;
public var temp:int;
public var Area_Nid:String;
public var SelIndicators:String;
public var RadarOS:SharedObject;
public var src:Array = [];
[Bindable] private var NomValue:Array=[];
public var activeVs:int=0;
//public var defaultXMLPath:String="default.xml";
public var defaultXMLPath:String="stock/Users/public/default.xml";
public var configXMLPath:String="config.xml";
public var webserviceWsdl:String="" ;
public var wsForSelection:String="" ;
private var lineSeries:Array = [];
private var columnSeries:Array = [];
private var fillStyles:Dictionary = new Dictionary();
private var visibleSeries:Object = new Object();
private var seriesMapping:Object = new Object();
private var SelectionWindow:TitleWindow=new TitleWindow;
//private var RadarSel:userSelection=new userSelection;
private var legendWindow:TitleWindow=new TitleWindow();
private var vboxProp:VBox;
private var pp:PropertiesPanel;
private var vbox:VBox= new VBox
private var BoolCalledFirstTime:Boolean=true;
public var seriesType:String="";
public var axes:String="";
public var lineForm:String="";
public var fill:String="";
public var strDatabaseName:String='';
[Bindable] public var defaultXML:XML =new XML();
public var defaultXMLValuePath:String="stock/Visualizers/diRadar/defaultdata.xml";
///////////passed the Source XML from my selection window, at first time it will work, but secont time same XML creates problem
public function setChartData(source:XML):void
{
//Alert.show(source.toString());
NomValue=[];
var xml:XML;
categories = [];
lineSeries=[];
columnSeries=[];
for each (xml in source.indicators.indicator)
{
categories.push(xml.toString());
}
countries = [];
dataSource = new ArrayCollection();
var i:int = 0;
var j:int = 0;
for each (var s:Object in source.country)
{
countries.push(s.#name.toString());
}
for each (var cat:String in categories)
{
var o:Object = new Object();
o["Category"] = cat;
dataSource.addItem(o);
}
i = 0;
for each (s in source.country)
{
j = 0;
for each (var value:Number in s.value)
{
NomValue.push(Number(Math.floor(Number(value)*1000)/1000))
dataSource.getItemAt(j)[countries[i]] = Number(Math.floor(Number(value)*1000)/1000);
j++;
}
i++;
}
createSeries(lineSeries,RadarLineSeries);
createSeries(columnSeries, RadarColumnSeries);
initSeriesMapping();
chart.series=lineSeries;
initLegend();
liner.maximum=Math.max.apply(null, NomValue)
////////Properties set at run time
if (lineForm=='1')
{
switchToSegment();
}
else
{
switchToCurve();
}
switch (axes)
{
case ('1'):
hAxis.visible=true;
vAxis.visible=false;
hAxis.includeInLayout=true;
vAxis.includeInLayout=false;
break;
case ('2'):
hAxis.visible=false;
vAxis.visible=true;
hAxis.includeInLayout=false;
vAxis.includeInLayout=true;
break;
case ('3'):
hAxis.visible=true;
vAxis.visible=true;
hAxis.includeInLayout=true;
vAxis.includeInLayout=true;
break;
case ('4'):
hAxis.visible=false;
vAxis.visible=false;
hAxis.includeInLayout=false;
vAxis.includeInLayout=false;
break;
}
if (seriesType=='1')
{
switchToLineSeries()
}
else
{
switchToLineSeries()
}
}
private function createSeries(array:Array, type:Class):void
{
var s:RadarSeries;
for each (var c:String in countries)
{
s = new type();
s.dataField = c;
s.displayName = c;
fillStyles[s] = s.getStyle("areaFill");
if (fill=='1')
{
s.setStyle("areaFill",fillStyles[s]);
}
else
{
s.setStyle("areaFill",emptyColor);
}
s.filterData = false;
s.setStyle('stroke', new Stroke(0xaaaaaa,1,0.7));
if (s is RadarLineSeries)
{
RadarLineSeries(s).setStyle('itemRenderer',new ClassFactory(CircleItemRenderer));
RadarLineSeries(s).setStyle('radius', 5);
}
if (s is RadarColumnSeries)
{
RadarColumnSeries(s).columnWidthRatio=0.6;
}
array.push(s);
}
}
private function initSeriesMapping():void
{
for each (var ls:RadarLineSeries in lineSeries)
{
for each (var cs:RadarColumnSeries in columnSeries)
{
if (ls.displayName == cs.displayName)
{
seriesMapping[ls.uid] = cs;
seriesMapping[cs.uid] = ls;
}
}
}
}
public function showSeries(key:String, value:Boolean = true):void
{
var s:RadarSeries;
if (visibleSeries[key] != value)
numVisibleSeries += value?1:-1;
visibleSeries[key] = value;
for each(s in chart.series)
{
s.visible = numVisibleSeries == 0 || visibleSeries[s.displayName];
seriesMapping[s.uid].visible = s.visible;
}
}
private function initListeners():void
{
}
private function SetDefaultProperties(pp:PropertiesPanel):void
{
pp.seriesType.selectedValue=seriesType;
pp.axes.selectedValue=axes;
pp.lineForm.selectedValue=lineForm;
pp.fill.selectedValue=fill;
}
private function switchToCurve(e:Event = null):void
{
for each (var s:RadarLineSeries in lineSeries)
s.setStyle("form", "curve");
}
private function switchToSegment(e:Event = null):void
{
for each (var s:RadarLineSeries in lineSeries)
s.setStyle("form", "segment");
}
private function switchToFillYes(e:Event = null):void
{
for each (var s:RadarLineSeries in lineSeries)
s.setStyle("areaFill", fillStyles[s]);
}
private function switchToFillNo(e:Event = null):void
{
for each (var s:RadarLineSeries in lineSeries)
s.setStyle("areaFill", emptyColor);
}
private function switchToColumnSeries(e:Event= null):void
{
chart.series = columnSeries;
chart.type = "circular";
}
private function switchToLineSeries(e:Event= null):void
{
chart.series = lineSeries;
chart.type = "polygonal";
}
private function initLegend():void
{
src = [];
for each (var s:RadarSeries in lineSeries)
{
src.push(s.legendData);
}
legend.dataProvider = src;
}
public function resetSeries(evt:MouseEvent):void
{
var s:RadarSeries;
for each(var li:DisplayObject in legend.getChildren())
{
if (li is CustomLegendItem)
(li as CustomLegendItem).selected = false;
}
for each(s in chart.series)
{
s.visible = true;
seriesMapping[s.uid].visible = true;
}
numVisibleSeries = 0;
numSelectedSeries = 0;
visibleSeries = new Object();
}
/***************Legend.as*************************/
public function showThePopUpLegend():void
{
//chart.series=columnSeries;
legendWindow=new TitleWindow();
legendWindow.showCloseButton=true;
legendWindow.height=260;
legendWindow.width=260;
legendWindow.title="Legend";
legendWindow.alpha=2.5;
legendWindow.addEventListener(CloseEvent.CLOSE,closeLegendPopup);
var appcnrl:ControlBar=new ControlBar();
appcnrl.setStyle("horizontalAlign","center");
appcnrl.setStyle("bottom","2");
appcnrl.setStyle("verticalGap","1");
appcnrl.height=40;
var btnok:Button=new Button;
btnok.label="Ok";
btnok.height=20;
btnok.width=70;
btnok.addEventListener(MouseEvent.CLICK,closelegendwindow);
appcnrl.addChild(btnok);
legendWindow.addChild(legend);
legendWindow.addChild(appcnrl);
PopUpManager.addPopUp(legendWindow,this,true);
PopUpManager.centerPopUp(legendWindow);
}
public function closeLegendPopup(e:Event):void
{
PopUpManager.removePopUp(e.currentTarget as IFlexDisplayObject);
}
public function closeLegend(e:MouseEvent):void
{
PopUpManager.removePopUp(PnlLegend);
}
public function showPropWindow():void
{
SelectionWindow=new TitleWindow;
SelectionWindow.title="Properties"
SelectionWindow.showCloseButton=true;
SelectionWindow.alpha=2.5;
SelectionWindow.height=270;
SelectionWindow.width=270;
SelectionWindow.addEventListener(CloseEvent.CLOSE,closePopup);
var appcnrl:ControlBar=new ControlBar()
pp=new PropertiesPanel;
SetDefaultProperties(pp);
pp.addEventListener("lineSeriesEvent", switchToLineSeries)
pp.addEventListener("columnSeriesEvent", switchToColumnSeries)
pp.addEventListener("nAxisEvent", function():void{hAxis.visible=false;vAxis.visible=false;});
pp.addEventListener("hAxisEvent", function():void{hAxis.visible=true;vAxis.visible=false;});
pp.addEventListener("vAxisEvent", function():void{hAxis.visible=false;vAxis.visible=true;});
pp.addEventListener("bAxisEvent", function():void{hAxis.visible=true;vAxis.visible=true;});
pp.addEventListener("curveFormEvent", switchToCurve);
pp.addEventListener("segmentFormEvent", switchToSegment);
pp.addEventListener("fillYesEvent", switchToFillYes);
pp.addEventListener("fillNoEvent", switchToFillNo);
var btnok:Button=new Button;
btnok.label="Ok";
btnok.width=50
btnok.addEventListener(MouseEvent.CLICK,closePropWindow);
appcnrl.percentWidth=100;
appcnrl.height=40;
appcnrl.setStyle("horizontalAlign","center");
appcnrl.setStyle("verticalAlign","bottom");
appcnrl.setStyle("verticalGap","1");
appcnrl.addChild(btnok);
SelectionWindow.addChild(pp);
SelectionWindow.addChild(appcnrl);
PopUpManager.addPopUp(SelectionWindow,this,true);
PopUpManager.centerPopUp(SelectionWindow);
}
public function closePropWindow(e:MouseEvent):void
{
setvalue();
PopUpManager.removePopUp(SelectionWindow);
}
private function setvalue():void
{
seriesType=pp.seriesType.selectedValue.toString();
axes=pp.axes.selectedValue.toString();
lineForm=pp.lineForm.selectedValue.toString();
fill=pp.fill.selectedValue.toString();
}
/************FUnction is USed to Handle the popUps***********/
private var conn:LocalConnection;
public function showThePopUpComponent(passedValue:String):void {
conn = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS, onStatus);
conn.send("RadarConnection", "OpenSelectionWindiow",passedValue);
}
private function onStatus(event:StatusEvent):void {
switch (event.level)
{
case "status":
trace("LocalConnection.send() succeeded");
break;
case "error":
trace("LocalConnection.send() failed");
break;
}
}
public function closePopup(e:Event):void
{
setvalue();
PopUpManager.removePopUp(e.currentTarget as IFlexDisplayObject);
}
public function closelegendwindow(e:MouseEvent):void
{
PopUpManager.removePopUp(legendWindow);
}
private function CancelSelection():void
{
PopUpManager.removePopUp(this)
}
private var point1:Point = new Point();
private var myMenu:Menu;
// Create and display the Menu control.
private function showMenu():void {
myMenu= Menu.createMenu(DisplayObjectContainer(hbMenu), MenuData,false);
myMenu.labelField="#label"
myMenu.addEventListener("itemClick", menuHandler);
// Calculate position of Menu in Application's coordinates.
point1.x=mybutton.x-10;
point1.y=mybutton.y;
point1=mybutton.localToGlobal(point1);
myMenu.show(point1.x, point1.y+20);
}
// Event handler for the Menu control's change event.
private function menuHandler(event:MenuEvent):void {
OpenPopUp(event.item.#value)
//Alert.show("Label: " + event.item.#value, "Clicked menu item");
}
private function OpenPopUp(ItemSelected:String):void
{
switch(ItemSelected)
{
case "0":
break;
case "1":
showThePopUpComponent(App_Type)
break;
case "2":
showThePopUpLegend()
break;
case "3":
showPropWindow()
break;
}
}
pls help me????
[dgarbari said:]
Hi,
Could you provide a [u]minimal[/u] and [u]runnable[/u] sample that reproduces your issue?
Thanks,
Damien

Related Links

Negative values ?
Disable datatip for some of the series...
Error updating radarchart
Change the orientation of the category label
Labels size
Customizing radar charts angular axis labels
Custom labelFunction for radarchart
Linear Gradient as fill for RadarColumnSerie
Dragging Radar Line Series
How to change angular axis minimum and maximum?
RadarColumnSeries Remove Column Tapering on Large Values
Need to create radar chart without writing code
Radar Labels don\'t update
Radarchart gradient background
Run Time Radar Data
Rotating the angular axis

Categories

DW
IBM Security
IBM SmartCloud Applica...
Jazz for Service Manag...
dwjapan
test
IBM Software Defined N...
Spark on z/OS
LPM (Live Partition Mo...
IBM Connections Social...
IBM CMIS for ECM
IBM Kenexa BrassRing o...
IBM Kenexa CompAnalyst...
Open Beta Feedback
Jazz for Service Manag...
Endpoint Protection
Education
Multi-Channel Fullfill...
IBM SPSS Modeler
IBM SPSS Statistics Sy...
IBM SPSS Collaboration...
RPG Cafe
EGL Cafe
IBM ILOG Visualization
Regional
BI Strategies
Eventos en Latinoamérica
Open Source
linux
workplace
db2
Education and Learning
Pattern Modeling and A...
On Demand
aW
Multicore enablement
Open Source
XML
InfoSphere Master Data...
IBM DB2 Recovery Exper...
InfoSphere Information...
IBM Db2 Event Store
WebSphere Application ...
WebSphere DataPower XC...
WebSphere Service Regi...
Tivoli Security Compli...
DSM Extensions, Custom...
Reports
HA - High Availability
Offense Manager & Tuning
VA & Scanners / Assets...
Network Surveillance, ...
Troubleshooting
Gentran Basic, RTE, Co...
Gentran Director
Gentran Server for Win...
General Discussion
IBM Control Center
JSP Webpages in GIS
Connect:Direct Mainframe
Product Information Ma...
Analytics & Reporting
Driving Usage
Backend Systems
C3 Configurator
Feature Request
The Selling System Use...
Data Services/Data Mig...
Performance & Optimiza...
Release 5.6
Picking
Location Inventory Tra...
Logistics
SQLserver
Weblogic
Java Visualization Pro...
Mathematical Programming
IBM ILOG BRMS Beta Pro...
IBM ILOG Elixir Enterp...
Radar charts
C++ Visualization Prod...
JRules BPM/SOA Integra...
Анонсы
DB2 Content Management
Activities
Scripting Tools for SA...
IBM Academic Initiativ...
IBM Tivoli System Auto...
IBM Tivoli Network Man...
IBM Tivoli Asset Disco...
IBM SmartCloud Control...
System Automation for ...
IBM i
iPhone
XQuery and XPath forum
ibmpub.java.aix
ibmpub.java.vmesa
IBM SCORE

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile