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! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
reload  
#1 Posted : Wednesday, October 6, 2010 4:08:05 PM(UTC)
reload
Rank: Member

Groups: Registered
Joined: 10/5/2010(UTC)
Posts: 20
Location: Minsk

Hello.
I have made a sample with drawing ChartCandleStick:

...init...
Code:

int candleColor = Color.BLACK;
point0 = new ChartPoint(
(double) i, new double[] { minimum, maximum, open, close });

point0.setBackColor(new Integer(candleColor));
point0.setBorderColor(new Integer(candleColor));


Code:

private void createCandleChart()
{
  chart.getChart().setPalette(new ChartPalette( 
    ChartPalette.Rainbow.getValues()));
  chart.setBorder(BorderFactory.createRoundedBorder(
    new XYEdges(4, 4, 4, 4)));
  chart.setSize(Display.getWidth() - 8, Display.getHeight() - 8);
  add(chart);

  ChartSeries series1 = new ChartSeries("S1", ChartTypes.CandleStick);
  ChartPointCollection series1Points = series1.getPoints();
  Vector chCollection = Core.app.history.getCandleData();

  if (chCollection != null)
    for (int i = 40; i < 100; i++)
    {
      ChartPoint ch = (ChartPoint) chCollection.elementAt(i);
      series1Points.add(ch);

      Utils.printChartPoint(ch);
    }

  ChartArea area = new ChartArea();
  area.getDefaultXAxis().setValueType(ChartAxis.TYPE_NUMBER);
  area.getDefaultXAxis().setLabelsMode(ChartAxis.MODE_RANGE_LABELS);
  chart.getAreas().add(area);
  chart.getSeries().add(series1);
  series1.setArea(area.getName());
  series1.setLabelFormat("%YVal%");

  ChartAxisScale axisScaleX = area.getDefaultXAxis().getScale();
  axisScaleX.setDesiredIntervalCount(3);

  ChartAxisScale axisScaleY = area.getDefaultYAxis().getScale();
  // axisScaleY.setRange(minPrice * 0.999, maxPrice * 1.001);
  axisScaleY.setDesiredIntervalCount(3);

  ChartAxis yAxis = area.getDefaultYAxis(); // new
  yAxis.setPosition(ChartAxis.POSITION_RIGHT);

  NumberFormat format = NumberFormat.getNumberInstance();
  format.setMinimumFractionDigits(4);
  format.setMaximumFractionDigits(5);
  yAxis.setFormat(format);
}


and get this :
the drawing is :(

Edited by moderator Thursday, October 7, 2010 4:02:36 PM(UTC)  | Reason: Not specified

File Attachment(s):
Chart_CandleStick.png (304kb) downloaded 9 time(s).

You cannot view/download attachments. Try to login or register.
alexk  
#2 Posted : Thursday, October 7, 2010 3:57:41 PM(UTC)
alexk
Rank: Administration

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 55
Man
Location: Ukraine, Lviv

Hi,

Can you attach image that you want to get?

It is hard to answer on your question without understanding what exactly you want to get.

Thanks
ArtfulBits Team
Product Director
reload  
#3 Posted : Thursday, October 7, 2010 5:19:22 PM(UTC)
reload
Rank: Member

Groups: Registered
Joined: 10/5/2010(UTC)
Posts: 20
Location: Minsk

in the image,attached, you can see that:

1)bodies of candles do not full Fill with color.
2)candles that are rising do not have bodies. The black one's;
and red a that represent price reduce have bodies.

why ?
Baydalka Volodymyr  
#4 Posted : Thursday, October 7, 2010 5:42:38 PM(UTC)
Baydalka Volodymyr
Rank: Member

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 447
Man

Hi,

CandeStick type uses custom attributes to fill body. Please use following code to set colors to fill.

Code:

series.setAttribute(ChartCandleStickType.PRICE_UP_COLOR, new Integer(Color.GREEN));
series.setAttribute(ChartCandleStickType.PRICE_DOWN_COLOR, new Integer(Color.BLUE));


Best regards,
Volodymyr Baydalka
Andriod development and support team
reload  
#5 Posted : Thursday, October 7, 2010 5:55:24 PM(UTC)
reload
Rank: Member

Groups: Registered
Joined: 10/5/2010(UTC)
Posts: 20
Location: Minsk

Thanks. Now all is working good!!!
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-2017 ArtfulBits. All rights reserved.