Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Line Series chart
learnbirt
Hi ,
There is a urgent issue .
Basically i have a Line series chart and several marker points on 'series 1'.
1)hOw can i 'Dynamically'(using script in 'onrender'of chart) make only the last marker point visible and rest of the marker points invisible.
2)how is it possible to apply this case to only 'Series 1' (y axis) and not on 'Series 2'(yaxis).As i have two series(series 1&2) in my line series chart .
3)marker lines can be generted at a particular location in chart using ' MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(great_value)' but how to set location for MarkerImpl.create(MarkerType markerType, int size)[as i need single marker point on series 1 and not marker line] ???
kindly let me know if there is a solution to it.
Thanks
birtq
Find more posts tagged with
Comments
mwilliams
Hi birtq,
For #2, you can select a series by using the following inside the before draw marker function:
if (dph.getSeriesValue().toString() == "Series_Name"){
//whatever you want to do
}
You can then do whatever you want for that series inside the if statement.
I'll look at #1 and #3 more and post if I find something.
mwilliams
birtq,
For #1, if you can find out how many datapoints you'll have, you can use an if statement to set the visibility of the marker with:
marker.setVisible(true/false);
in the beforeDrawMarker() function.
For #3, can you explain a little more what you're looking for? Thanks.
learnbirt
Hi Michael,
Thanks a lot for your reply.
I have implemented dynamic 'Marker Point '.I have used the code mentioned below but still there is one issue .
In 'Onfetch' of dataset i have declared the requied global variables whose value can be fetched in 'Onrender ' of chart
y=row.FirstValue;
x=row.SecondValue;
if(x!=null && y!=null){
if(x>MaxX)
MaxX = x;
if(y>MaxY)
MaxY = y;
LeastSquare.addPoint(x,y);
FlagCounter++;
}
if(row.override==1 && y!=null)
{
Override=1;
}
else
{
Override=0;
}
if(row.override==1 && x!=null)
{
Overridex=1;
}
else
{
Overridex=0;
}
reportContext.setPersistentGlobalVariable("Override",new Integer(Override));
reportContext.setPersistentGlobalVariable("Overridex",new Integer(Overridex));
if(y!=null )
{
security1_override = y.toFixed(3).toString();
reportContext.setPersistentGlobalVariable("Override1",security1_override);
}
if(x!=null )
{
security2_override = x.toFixed(3).toString();
reportContext.setPersistentGlobalVariable("Override2",security2_override);
}
Inside 'Onrender' of chart i have mentioned
function beforeDrawMarker( marker ,dph, icsc)
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
var min_value1 = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Override");
var over = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Overridex");
min_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Override1");
min_value3 = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Override2");
w1=new Float(min_value);
w2=new Float(min_value3);
if( dph == null ){
marker.setVisible(false);
}
else
{
var ms = dph.getOrthogonalValue();
if( min_value1 == 1 && ms==w1)
{
marker.setType(MarkerType.CROSS_LITERAL);
marker.setSize(4);
marker.setVisible(true);
}
var ms1 = dph.getOrthogonalValue();
if( over == 1 && ms1==w2 )
{
marker.setType(MarkerType.CROSS_LITERAL);
marker.setSize(4);
marker.setVisible(true);
}
}
}
function beforeDrawDataPoint(dph, fill, icsc)
{
fill.set(0,255,0)
}
This code works only when i repalce :
if( over == 1 && ms1==w2 ) (mentioned in the above code)
by if( over == 1 && ms1==26.70 )
and if( min_value1 == 1 && ms==w1)
by if( min_value1 == 1 && ms==84.50)
Kindly let me know how to make it work.Global variables are correctly displaying values in the report but in chart the comparision is getting failed.
Thankyou sooo much
birtq
mwilliams
birtq,
I'm not sure why that would be. Not being able to test your design makes my guess even more difficult. You may try checking the string value of the PGVs in the chart by setting a test to only set the marker if that is what you expect it to be. Though, when I had done this the same way with an integer yesterday, it worked. Not sure if the way you create the float number could be it, but you could try creating the float by using w1 = parseFloat(min_value) instead of what you're currently doing and see what happens.
Let me know if any of this helps. If it doesn't, if you can send me your report design and a csv file of your data that I can use to run it or recreate this scenario with the sample db where it doesn't work for you, maybe I can help more.
learnbirt
Hi Michael,
Thankyou soo much ..yes i will definately try it out tommorow (in office)and let you know.
Thanks
birtq
learnbirt
Hi Michael,
Dynamic Markers worked well when i used w1 = parseFloat(min_value).
Thankyou
birtq
mwilliams
birtq,
Excellent! Glad I could be of service.
Let us know whenever you have questions.