Hi
Agenda:In this post i would like to explain how we can programmatically create series set and alert set in bar and horizontal bar graph.
Explanation about Series Set and Series tag :
Tag is :<dvt:series> and <dvt:seriesSet>
<dvt:series> is for giving or changing information for single bar at a time
<dvt:seriesSet> is for giving or changing information all bar which are present in the bar graph.
It has a lot of attribute which will apply in all bar graph.
Series set is use for changing color ,space and other property of the bar in bar graph.<dvt:series> tag is good only if you know how may bar are generated at run time.And also if you have 10-20 series then in this case also you have to put same number of tag into UI source code which is tedious.
<dvt:seriesSet> has one attribute SeriesMap where we can pass the value series and it will generate different type of series at run time.
Code are following for creating series map. It map contains key as Integer and value as a object of the Series.Here i am just changing color of one series but you can also change other property.
Here i am changing color of the first series to green therefore i passed 0 as key in map.
private Map<Integer,Series> seriesMap;
public void setSeriesMap(Map<Integer, Series> seriesMap) {
this.seriesMap = seriesMap;
}
public Map<Integer, Series> getSeriesMap() {
if(seriesMap==null){
seriesMap=new HashMap<Integer,Series>();
Series s1=new Series();
s1.setColor(Color.GREEN);
seriesMap.put(0, s1);
}
return seriesMap;
}
Explanation about Alerts Set and Alert tag :
Tag :<dvt:alert> and <dvt:alertSet>
This tag are use to show waring and error in bar chart.<dvt:alert> is for showing single bar warning and error where else <dvt:alertSet> contians information of bars at a same time.
So here i am putting warning image in first bar which has Example_Bar_1 as column value.
public void setAlertSet(Map<Integer, Alert> alertMap) {
this.alertMap = alertMap;
}
public Map<Integer, Alert> getAlertSet() {
String text = "Example_Bar_1";
alertMap = new HashMap();
Alert al1 = new Alert();
al1.setXValue(text);
al1.setYValue(80.00);
al1.setImageSource("/images/warningIcon.png");
alertMap.put(0, al1);
return alertMap;
}
i have put image under images folder.
Download sample application at following location
link :https://docs.google.com/file/d/0B8cP4jZuxLlXZGpHLXZhLTdYVjg/edit?usp=sharing
Thanks
Prateek
Agenda:In this post i would like to explain how we can programmatically create series set and alert set in bar and horizontal bar graph.
Explanation about Series Set and Series tag :
Tag is :<dvt:series> and <dvt:seriesSet>
<dvt:series> is for giving or changing information for single bar at a time
<dvt:seriesSet> is for giving or changing information all bar which are present in the bar graph.
It has a lot of attribute which will apply in all bar graph.
Series set is use for changing color ,space and other property of the bar in bar graph.<dvt:series> tag is good only if you know how may bar are generated at run time.And also if you have 10-20 series then in this case also you have to put same number of tag into UI source code which is tedious.
<dvt:seriesSet> has one attribute SeriesMap where we can pass the value series and it will generate different type of series at run time.
Code are following for creating series map. It map contains key as Integer and value as a object of the Series.Here i am just changing color of one series but you can also change other property.
Here i am changing color of the first series to green therefore i passed 0 as key in map.
private Map<Integer,Series> seriesMap;
public void setSeriesMap(Map<Integer, Series> seriesMap) {
this.seriesMap = seriesMap;
}
public Map<Integer, Series> getSeriesMap() {
if(seriesMap==null){
seriesMap=new HashMap<Integer,Series>();
Series s1=new Series();
s1.setColor(Color.GREEN);
seriesMap.put(0, s1);
}
return seriesMap;
}
Explanation about Alerts Set and Alert tag :
Tag :<dvt:alert> and <dvt:alertSet>
This tag are use to show waring and error in bar chart.<dvt:alert> is for showing single bar warning and error where else <dvt:alertSet> contians information of bars at a same time.
So here i am putting warning image in first bar which has Example_Bar_1 as column value.
public void setAlertSet(Map<Integer, Alert> alertMap) {
this.alertMap = alertMap;
}
public Map<Integer, Alert> getAlertSet() {
String text = "Example_Bar_1";
alertMap = new HashMap();
Alert al1 = new Alert();
al1.setXValue(text);
al1.setYValue(80.00);
al1.setImageSource("/images/warningIcon.png");
alertMap.put(0, al1);
return alertMap;
}
i have put image under images folder.
Download sample application at following location
link :https://docs.google.com/file/d/0B8cP4jZuxLlXZGpHLXZhLTdYVjg/edit?usp=sharing
Thanks
Prateek