We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ValueAxis.set{Min- Max}Value() in Logarithmic Chart

Hi,


I’m trying to create logarithmic chart with Aspose.Cells for Java.
And I want to set ValueAxis’s minimum value and maximum value.
But It only accepts a logarithmic value in INTEGER.
How can I set a logarithmic value in double or a non-logarithmic value?

I works with version 2.4.0 .

Regerds,

Hideyuki TAKEUCHI

Hi,



Thanks for your inquiry.



Well, using Aspose.Cells for Java 2.4.0, I was able to set double / log values for Min and Max Vertical Axis of Scatter Chart Type. The Excel file create from the below code is attached for your reference.

try {
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Access firs sheet
Worksheet worksheet = workbook.getWorksheets().getSheet(0);
//Add Scatter type chart
int chartIndex = worksheet.getCharts().add(ChartType.SCATTER, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.getCharts().getChart(chartIndex);
//Set cell values
worksheet.getCells().getCell(“A1”).setValue(“x”);
worksheet.getCells().getCell(“A2”).setValue(“y”);
worksheet.getCells().getCell(“B1”).setValue(0);
worksheet.getCells().getCell(“B2”).setValue(0);
worksheet.getCells().getCell(“C1”).setValue(0.3);
worksheet.getCells().getCell(“C2”).setValue(0.3);
worksheet.getCells().getCell(“D1”).setValue(0.7);
worksheet.getCells().getCell(“D2”).setValue(0.6);
worksheet.getCells().getCell(“E1”).setValue(1);
worksheet.getCells().getCell(“E2”).setValue(1.2);
worksheet.getCells().getCell(“F1”).setValue(1.3);
worksheet.getCells().getCell(“F2”).setValue(2.41);

//Add chart data source
chart.getNSeries().add(“A1:F2”,true);
//Set vertical min value
chart.getValueAxis().setMinValue(0.5);
//Set vertical max value
chart.getValueAxis().setMaxValue(2.5);
//Save workbook
workbook.save(“d:\chartLogJ.xls”);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

If you find such issue in some particular scenario, please provide us the sample application showing the issue. We will investigate it further.

Kind Regards

Hi, Muhammad

Thank you for your response.

I want to create logarithmic chart.

So, your code shuold be

//Add chart data source
chart.getNSeries().add("A1:F2",true);

// ADDED: Set plotting logarithmic
chart.getValueAxis().setLogarithmic(true);

//Set vertical min value
chart.getValueAxis().setMinValue(0.5);
//Set vertical max value
chart.getValueAxis().setMaxValue(2.5);

And this code generate Excel file with ValueAxis,
its minvalue is 1 = (log10((int) 0.5)) and maxvalue is 100 = (log10((int) 2.5)).

I want to set minvalue to 200 in Excel file.

Regards,

--
Hideyuki TAKEUCHI

Hi,

Thanks for sharing further details.

The mentioned issue has been logged into our Issue Tracking System as 19792 for further investigations. We will update you about our findings regarding your requirement.

Kind Regards

Hi,

After further investigation, <span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”;”>we don’t think MS EXCEL2003 can support such
a feature. You cannot set such max/min values e.g 0.5/2.5 in MS EXCEL2003 manually, you may confirm it too. In MS EXCEL2007, such values can be set properly. And, if saving the workbook
as Excel2007 file formats, such values will be saved correctly by Aspose.Cells for Java
too. Therefore, we can say it is the limitation and behaviors put forth by different MS Excel versions (e.g XLS (2003) and XLSX(2007)).

Thank you.

Hi,


OK, I checked it with MS EXCEL2003 machine and I understood why it was.
I had checked it in MS EXCEL2007 only.

Thank you for your quick and thorough response.

Hideyuki Takeuchi