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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/discussing-com%3Asun%3Astar%3Achart2-API-tp19268400p19575557.html
Sent from the openoffice - api dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to