ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  remove few things from finance chart
Posted by John on Aug-29-2013 02:10
Attachments:
hi peter,
i had a couple of quick questions with regards to the finance chart (see attachment):

1. how do i remove the date from the initial datetime component of my x labels on the
finance chart? i know these are actually strings to be read for the user, but in my labels, i
only keep the time component, as seen in the chart. however, the first one always contains
the date too, which i want to get rid of.

2. how do i remove both the open/high/low/close "indicator" (green) at the top-left corner
of the chart in the grey bar, as well as the volume = 1.842k indicator (keeping only the
color box and "Vol"), since those data do not correspond to the whole day's data, just one
candle?

the items of interest are circled in red.

let me know,
thanks,
john
samplefinchart1.png

  Re: remove few things from finance chart
Posted by Peter Kwan on Aug-30-2013 04:51
Hi John,

1. The x-axis label format can be configured using FinanceChart.setDateLabelFormat. For example, in Java/C#, it can be like:

//use same label format hh:nn for all cases
myFinanceChartObj.setDateLabelFormat("{value|hh:nn}", "{value|hh:nn}", "{value|hh:nn}", "{value|hh:nn}", "{value|hh:nn}", "{value|hh:nn}", "{value|hh:nn}");

Note that the label format should be set up before the data are passed to ChartDirector (before FinanceChart.setData).

2. In general, to modify the legend format, you may modify the FinanceChart source code. The FinanceChart is open source and the source code is included in the download. Please refer to the documenation on FinanceChart for details.)

However, if you do not want to modify the FinanceChart source code, the following methods may work for your particular case:

(a) To remove all legend entries from the main price chart, you may simply move the legend box away. For example (in Java/C#):

//when you add the main price chart, store the returned XYChart in a variable
XYChart m = myFinanceChartObj.addMainChart(.........);
//move the legend box outside the chart
m.getLegend().setPos(-9999, -9999);

(b) For the volume bar chart, you may use something like:

//Add volume indicator
XYChart v = c.addVolIndicator(........);
//Remove the automatic legend entry
v.getLayer(0).setLegendOrder(Chart.NoLegend);
//Add the legend key with just a color box and some text
v.getLegend().addKey("Vol", 0x99ff99);

Hope this can help.

Regards
Peter Kwan