Setting CategoryType in Chart in Java version



Is it possible to set the CategoryType for a chart in Aspose.Cells for Java? I want to set the CategoryAxis to CategoryScale instead of defaulting to Automatic.




We will support this feature .It will take one day to do it.


Works great!!

Now all I need is to be able to insert a text box Smile [:)] (At least until the next thing I need)

Thanks, Steve



You can insert a text box with this version.But we will change the unit of width or height of the text box in the next version .


I should have said I wanted to insert a text box on a CHART SheetType sheet.

I just tried it and it works fine for a WORKSHEET but doesn't show anything if I try to add one to a CHART.

Also for Textboxes

1. Is there a way to set the background color or set it to transparent?

2. Is there a way to set the color of the border line or set it to no line?




We will add the feature inserting a text box to a Chart SheetType sheet.It will take one week .

It is complex to set the properties of the text box . Is it necessary for you? We think it will take two or more weeks to support setting the properties.


Hi Warren,

The text box properties will be important to us since the default is currently white background with black text and a black border and for our use we would need initially to be able to set transparent background and no border and then to have full control.




Please try this fix. The fill and line property of the shape have bean supported in this fix.

Note : If you want to add the text box to the chart or CHART SheetType sheet, you should get TextBoxes Object from the chart.See sample codes :

TextBoxes textBoxes = chart.getTextBoxes();
int index = textBoxes.add(0,0,0,0,100,100);
TextBox textBox = textBoxes.get(index);
ShapeFill shapeFill = textBox.getFill();
ShapeLine line = textBox.getLine();


Thanks Warren,

It's working great.

Is there was a way to get the left, top, width, and height settings of the plot area and the chart area? Because I can insert a textBox and then position and size it by pixel, CM, and Inch now I need some information about the space where it can be inserted. I want to be able to do things like center the text in the center of the plot area or just below center, etc.




Hi Steve,

Please try this fix. You can add text box in units of 1/4000 of char area :


And the methods of getting and setting position and size of the plot area have bean supported.


How do you use the1/4000 of chart area to convert to inches/pixels/cm? I tried the following code to move a textbox to the upper leftmost corner of the plot area and the calculations don't come out. I am assuming the plot area is just the rectangular area where the chart is, not including the labels etc.


// Get the chart area dimensions to figure out where to put text.
ChartArea chtArea = chart.getChartArea();
float iChtXIn = chtArea.getTopInch();
float iChtYIn = chtArea.getLeftInch();
float iChtHeightIn = chtArea.getHeightInch(); // 6.25 on my PC
float iChtWidthIn = chtArea.getWidthInch(); // 10.208333 on my PC

PlotArea chtPlotArea = chart.getPlotArea();
int iPlotX = chtPlotArea.getX(); // 36 on my PC
int iPlotY = chtPlotArea.getY(); // 62 on my PC

// Assuming to get PlotArea X location in Inches need to get 1/4000 of the ChartArea width in Inches
float fTextXIn = (iChtWidthIn / (float)4000.0) * (float)iPlotX; // 0.0918
// Assuming to get PlotArea Y location in Inches need to get 1/4000 of the ChartArea height in Inches
float fTextYIn = (iChtHeightIn / (float)4000.0) * (float)iPlotY; // 0.0968



Hi Steve,

Please try this fix.The bug of the plot area location and size has been fixed. And if you want to add text box to the upper leftmost corner of the plot area ,please tye the following code:

PlotArea plotArea = chart.getPlotArea();
int iPlotX = plotArea.getX();
int iPlotY = plotArea.getY();
int iPlotWidth = plotArea.getWidth();
int iPlotHeight = plotArea.getHeight();
TextBoxes textBoxes = chart.getTextBoxes();

int index = textBoxes.addInChart(iPlotX,iPlotY,iPlotWidth / 2 ,iPlotHeight / 2);


Hi Warren,

This worked great. Both with the code I had and wth the code you supplied.

I have a couple of other requests. Should I start a new thread for them? One is related to vertical and horizontal alignment of text in a TextBox and the other was rotation of text in titles (Particularily for ValueAxis)



Hi Steve,

Please try this fix.What you need have bean supported.

And please start a new thread for other requests.


Thanks again Warren. You guys are great!!!

I will start a new thread for any future requests.