whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest Search | Active Topics | Log In | Register

Chart Range Column Annotation Options · View
cesaripaolo
#1 Posted : Monday, January 23, 2012 11:55:48 AM
Rank: Member

Groups: Registered

Joined: 10/17/2011
Posts: 16
Location: Italy
I need a help in the usage of ChartAnnotations and the customization of the Range Column Chart.
I'have defined Range Column Chart in this manner:

ChartType VERTICAL_RANGE_COLUMN = new ChartRangeColumnType() {
public boolean isRotated() {
return true;
}

public boolean isSideBySide() {
return false;
};

};

I want to plot different series of data so it is necessary to insert labels/text on the bar(or as background behind the area of the series) that specifies the name of the series.
Trying to accomplish this task I looked at
http://www.artfulbits.co...port/resource.ashx?a=95
I have inserted data in the series:
chartSeries.getPoints().addXY(1, 10,200);chartSeries.getPoints().addXY(3, 10, 130);
chartSeries.getPoints().addXY(7, 10, 1300);
chartSeries.getPoints().addXY(9, 1, 300);
and then I
insert ChartText Annotation in this manner:
ChartTextAnnotation annotation1 = new ChartTextAnnotation("Label_1");
annotation1.setTextColor(Color.YELLOW);
chartArea.getDefaultXAxis().setScrollBarEnabled(true);
annotation1.setPosition(new CustomAnnotationPosition(chartArea, 15, 0));
chartView.getChart().getAnnotations().add(annotation1);

The CustomAnnotationPosition class is done the same as StripLine example:
public class CustomAnnotationPosition extends ChartAnnotationPosition
{
private final ChartArea m_area;
private final double m_x;
private final double m_y;

public CustomAnnotationPosition(ChartArea area, double x, double y)
{
m_area = area;
m_x = x;
m_y = y;

}

@Override
protected PointF getPin(ChartEngine chart)
{
PointF pointF = new PointF();
ChartTransform.create(m_area).getPoint(m_x, m_y, pointF);
return pointF;
}
}

Questions:
1)can I customize my VERTICAL_RANGE_COLUMN inserting a TextAnnotation on the bar?how can I do this? like in textInBar
2)I want the text annotation placed in the center of the bar and I want to compute the text size depending on the bar size..
3)if I scroll the axis I want the annotation visible(the annotation should also scroll)
4)another way should place the annotation in the area series like in image textOutBar and it should scrollable too.How can I do this?

Thank you in advance for your attention
Paolo Cesari
cesaripaolo attached the following image(s):
textInBar.png (17kb) downloaded 36 time(s).
textOutBar.png (21kb) downloaded 36 time(s).
Baydalka Volodymyr
#2 Posted : Monday, January 23, 2012 3:13:21 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Try to use ChartPoint.setLabel instead of annotation and next code for VERTICAL_RANGE_COLUMN.

Code:
ChartType VERTICAL_RANGE_COLUMN = new ChartRangeColumnType() {
public boolean isRotated() {
return true;
}

public boolean isSideBySide() {
return false;
};

@Override
public void getMarkerPoint(ChartRenderArgs args, ChartPoint point, int index, PointF outPoint)
{
    double x = point.getX() + args.getSideBySideOffset().center();
    double y = (args.ActualYAxis.getOrigin() + point.getY(index)) / 2;

    args.getPoint(x, y, outPoint);
}

};

...
series.getPoints.addXY(10, 30, 50).setLabel("label");

Volodymyr Baydalka
Andriod development and support team
cesaripaolo
#3 Posted : Tuesday, January 24, 2012 9:54:28 AM
Rank: Member

Groups: Registered

Joined: 10/17/2011
Posts: 16
Location: Italy
I have tryed your code but it doesn't work. I use aiChart library 1.5 and 2.0 and the result is the same, because the method getMarkerPoint is never called.
How can I do If I decide to put the label on the area behind the series?

Thank you very much for your attention
paolo cesari
cesaripaolo attached the following image(s):
bar.png (124kb) downloaded 29 time(s).
Baydalka Volodymyr
#4 Posted : Tuesday, January 24, 2012 9:59:02 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Sorry, that code really doesn't work. Please, try to change the getMarkerPoint to

Code:
@Override
public void getMarkerPoint(ChartRenderArgs args, ChartPoint point, int index, PointF outPoint)
{
    double x = point.getX() + args.getSideBySideOffset().center();
    double y = (point.getY(index) + point.getY(index + 1)) / 2;

    args.getPoint(x, y, outPoint);
}


Best regards,
Volodymyr Baydalka
Andriod development and support team
cesaripaolo
#5 Posted : Tuesday, January 24, 2012 10:42:49 AM
Rank: Member

Groups: Registered

Joined: 10/17/2011
Posts: 16
Location: Italy
Sorry for the silly question:
In the library I have to Override this method:
@Override
protected PointF getMarkerPoint(ChartRenderArgs args, ChartPoint point, int yIndex) {}
and not yours:
public void getMarkerPoint(ChartRenderArgs args, ChartPoint point, int index, PointF outPoint){}
so the latter is never called..and doesn't override the previous.
How can I do?

Best regards,
Paolo Cesari
Baydalka Volodymyr
#6 Posted : Tuesday, January 24, 2012 6:04:17 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

There is complete sample for version 1.5.0.3

Best regards,
File Attachment(s):
aiCharts.VerticalRangeColumn.zip (16kb) downloaded 3 time(s).
Volodymyr Baydalka
Andriod development and support team
cesaripaolo
#7 Posted : Wednesday, January 25, 2012 12:53:02 PM
Rank: Member

Groups: Registered

Joined: 10/17/2011
Posts: 16
Location: Italy
Great!
I was using lib version 2.0 and the code didn't work!!

Thank you very much!
Regards
Paolo Cesari
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.