Hi,
I am sorry to say that even when you take the right axes the idea will
not work. Those distance settings are ignored for category axes in the
current state.
So, sorry there is no way to get the grid lines placed more pleasant in
your scenario.
Ingrid
Ingrid Halama wrote:
Hi,
A newly created axis is not attached to any chart without further
action. Instead of creating a new axis you should fetch the existing one
from the chart document. I described how to obtain the primary x axis
already in my mail from 17th September.
In addition you should get the ScaleData from the axis before changing
it. There are other settings besides Distance and their defaults might
be not the correct settings for the category axis.
Kind regards,
Ingrid
othman wrote:
Hi Ingrid,
my code below seems to have no effect . am i missing something ?
Object object = xMCF.createInstanceWithContext(
"com.sun.star.chart2.Axis", xContext);
com.sun.star.chart2.XAxis xaxis = (com.sun.star.chart2.XAxis)
UnoRuntime.queryInterface(
com.sun.star.chart2.XAxis.class, object);
// System.out.println(xaxis);
ScaleData scaledata = new ScaleData();
IncrementData incData=new IncrementData();
incData.Distance=30;
scaledata.IncrementData=incData;
xaxis.setScaleData(scaledata);
Ingrid Halama wrote:
Hi,
othman wrote:
Hi Ingrid ,
Just discard my last email where i reported a bug about renaming
sheets .
actually i solved the issue . I was probably doing some mistake ,but
now
i
get correct behavior .
The most important thing for me now is to arrange the vertical grid
labels
in ranges of 1 month .
1-while thinking about the hack you described in last emails ; if i
clear
date cells that i don't need to display , will the corresponding
vertical
grid of empty cells be drawn in chart diagram ?
Yes.
2- we get the range sequence using code :
com.sun.star.chart2.data.XDataSequence
oSequence=oDataProv.createDataSequenceByRangeRepresentation(string_range);
oSequence object has a getData() method that returns an array of
Object[]
i was thinking i can process array getData() and then set the new
processed
data to oSequence ; however oSequence doesn't have a setData() method .
is
it possible to assign an array of Object[] to a XDataSequence
instance ?
With the current implementation, there are two ways the chart has its
data:
1) All the data comes from the parent document (calc or writer)
2) The chart has all the data itself
There is no possibility to mix this so far. To move from state 1) to
state 2) use method createInternalDataProvider at the chart document.
i think this workaround could help me solve the x-axis label ranges
without
inserting a new dummy column. what you think ?
it would really make me a happy man if you propose some other
solution to
make the vertical grid for x-axis dates more readable?
If you do not insist on having exactly monthwise labels you can try
to play around with the IncrementData settings at the ScaleData at
the x
axis:
http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/IncrementData.html
http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/ScaleData.html
Try to set the Distance to 30 for example. Not sure whether these
settings will be saved and loaded properly as this is not a supported
feature for category axes so far. Just try it. The minor intervals
can be set with the SubIncrements:
http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/SubIncrement.html
Kind regards,
Ingrid
thanks.
othman wrote:
Thanks much Ingrid ,i'll try using this workaround .
As you can see this discussion may be useful to discover bugs and
improve
the charting component.
I think i discovered another bug related to calc sheets renaming. here
is
the situation:
1-I open a calc spreadsheet with 3 initial sheets : (Sheet1
,Sheet2,Sheet3)
2-programatically from java code i insert a new sheet ( Sheet4)
3-manually from OO.o i rename (Sheet4) to (Sheet4_bis) (i did that
manually not from java code) 4-when i query the array of sheet
elements Names i got : (Sheet1
,Sheet2,Sheet3,Sheet4_bis, Sheet4)
as you can see renaming (Sheet4) didn't removed this sheet name from
sheets array names :it only push it to end of sheets elemets array .
is this a bug ? how can i fix this issue ? i need when i rename a
sheet
manually; the old sheet name (sheet4) should be replaced by new
name and
sheet name (Sheet4) must be removed from sheets elements array.
thanks much .
othman.
Ingrid Halama wrote:
Hi,
That is a bug. You can do the following to work around:
Query the Chart document for interface XMultiServiceFactory:
http://api.openoffice.org/docs/common/ref/com/sun/star/lang/XMultiServiceFactory.html
Use method createInstance with service name
"com.sun.star.drawing.DashTable" to get the dash table use by the
chart.
http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/DashTable.html
Now insert your newly created dash to the table using the method
insertByName. You will need to create a unique name for your dash
here.
Use this unique name and set it to the property "LineDashName"
instead of setting the property "LineDash".
Kind regards,
Ingrid
othman wrote:
Hi Ingid ,
thanks for providing the hack ..it is never a good Idea to hack ;
but
if
i
have no other choice then i'll try your method.
there is a small issue i'm facing with the diagram vertical grid : i
want to
have a dashed line vertical grid . i wrote code to get this effect
(see
code
below) .it indeed displays the dashed line for vertical grid
..but the
problem is when i tried to play with the attributes of LineDash, it
always
gives me same dashed grid. it seems that this line code is not
executed : xGridProp.setPropertyValue(
"LineDash", aDash );
because if i comment this line code i get the same grid as if i
don't
comment it .
can you point me what is the issue with LineDash ?
thanks .
code:
// x major grid
XPropertySet xGridProp = (XPropertySet)
UnoRuntime.queryInterface(
XPropertySet.class,
( (XAxisXSupplier) UnoRuntime.queryInterface(
XAxisXSupplier.class, maDiagram )).getXMainGrid());
if( xGridProp != null )
{
LineDash aDash = new LineDash();
aDash.Style = DashStyle.ROUND;
aDash.Dots = 2;
aDash.DotLen = 10;
aDash.Dashes = 1;
aDash.DashLen = 200;
aDash.Distance = 100;
xGridProp.setPropertyValue( "LineColor", new Integer(
0x000000
));
xGridProp.setPropertyValue( "LineStyle",
LineStyle.DASH );
xGridProp.setPropertyValue( "LineDash", aDash );
xGridProp.setPropertyValue( "LineWidth", new Integer( 30
));
}
Ingrid Halama wrote:
Hi,
othman wrote:
Hi Ingrid,
I believe the zooming feature might be beyond the scope of my
project
requirements now..
Ok.
anyway i wish if you can think adding the feature of scaling the
dates
x-axis values for candle charts : date objects are a widely used
data
type
and offering this feature of scaling date ranges would be a good
Idea.
I agree and I know. There are still a lot of issues of similar
quality. Work is ongoing.
i have a small issue :
There is concern on the x-axis labels. I need to display only one
date
label for each month. For instance, if the chart starts from Dec 6
2007,
there should be labels of 12/6/2007, 1/6/2008, 2/6/2008, 3/6/2008,
4/6/2008,
5/6/2008 on x-axis. and other date labels should not be
displayed on
x-axis
. how can i implement this ?
At the moment there exists no good/normal/acceptable way to do
that (neither API nor user interface). You can only try to hack:
Assuming you have a data point for each day (ordered in time)
and you have a cell range containing all those days you can try the
following:
Copy all the dates to another location in the calc. Calculate which
of the days you want to display and which not. Clear the cells
with the dates that you do not want to display. Use the newly
created
cell-range (including all the cleared cells) for display of the
categories. To
use the new range for category display you need to do the
following:
Query the com::sun::star::chart2::Diagram for interface
XCoordinateSystemContainer
(http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/XCoordinateSystemContainer.html).
Get the first coordinate system:
http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/XCoordinateSystem.html.
At the coordinate system use method getAxisByDimension(0,0) to get
the primary x axis
(http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/XAxis.html).
At the axis get the scale data by using method getScaleData
(http://api.openoffice.org/docs/common/ref/com/sun/star/chart2/ScaleData.html).
At the scale you will find a member "Categories" of type
XLabeledDataSequence. You know already how to create such objects
from cell ranges. Set the role of the values to "categories" in
this case. Then set the new sequence to the Categories member
and set the
changed scale back to the axis (setScaleData). Be careful when
playing around with the other scale settings as not all of them
are saved and
loaded, some do not have an effect at all so far.
This hack has a problem. When the user changes the original dates
after creation of the chart, the chart will not reflect those
changes.
Don't know whether that is important in your scenario.
Kind regards,
Ingrid
thanks.
othman.
Ingrid Halama wrote:
Hi,
othman wrote:
Hi Ingrid,
as we all know the candle chart has two bars (black and white)
I guess that by changing the bar width, the chart can have a
larger
date
range displayed.
No.
I am not sure whether this is the correct direction to fix
the x-axis scale problem . what you think about that ? and is it
possible
to
change the width of candle chart bars ?
No, that is not the right direction to fix the problem. It is
not possible to set a manual width to the candles. The width is
calculated automatically dependent on the amount of data and
the place
provided.
So again, I would suggest to change the data ranges on your
zooming
control.
thanks
othman
Kind regards,
Ingrid
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]