Free Support Forum - aspose.com

Scatter chart - category axis

Hi,

My problem is that I can’t set category axis as I want.
my code :

int row = 4;
int chartIndex = chartsVibration.add(ChartType.SCATTER, row, 1, row+18, 20);
Chart chart1 = chartsVibration.get(chartIndex);
for(int i = 0; i<labels.size(); i++)
{
cellsPageVibration.get(row, 23+i).setValue(labels.get(i));
cellsPageVibration.get(row+1, 23+i).setValue(valeursX.get(i));
cellsPageVibration.get(row+2, 23+i).setValue(valeursY.get(i));
cellsPageVibration.get(row+3, 23+i).setValue(valeursZ.get(i));
}
String nomPremierCellLabels = cellsPageVibration.get(row, 23).getName();
String nomDernierCellLabels = cellsPageVibration.get(row, 23+labels.size()-1).getName();
String nomPremierCellValeurs = cellsPageVibration.get(row+1, 23).getName();
String nomDernierCellValeurs = cellsPageVibration.get(row+3, 23+labels.size()-1).getName();

SeriesCollection nSeries = chart1.getNSeries();
nSeries.setCategoryData(nomPremierCellLabels+":"+nomDernierCellLabels);

nSeries.add(nomPremierCellValeurs+":"+nomDernierCellValeurs, false);
nSeries.setColorVaried(true);

Axis valueAxis = chart1.getValueAxis();
valueAxis.getTitle().setText(“mm/sec”);
valueAxis.setMinValue(0);
valueAxis.getTitle().setTextVerticalAlignment(TextAlignmentType.JUSTIFY);
valueAxis.setVisible(true);

Axis categoryAxis = chart1.getCategoryAxis();
categoryAxis.getTitle().setText(“Heure”);

Series series1 = nSeries.get(0);
series1.setValues(nomPremierCellValeurs+":"+cellsPageVibration.get(row+1, labels.size()-1).getName());
series1.setName(“Vitesse vibratiore X”);

Series series2 = nSeries.get(1);
series2.setValues(cellsPageVibration.get(row+2, 23).getName()+":"+cellsPageVibration.get(row+2, labels.size()-1).getName());
series2.setName(“Vitesse vibratiore Y”);

Series series3 = nSeries.get(2);
series3.setValues(cellsPageVibration.get(row+3, 23).getName()+":"+nomDernierCellValeurs);
series3.setName(“Vitesse vibratiore Z”);

As category axis labels I want to see: 00:00, 01:00, 02:00 etc. up to 23:59,
and here I got : 0, 500, 1000, up to 3500
What do I wrong? Please, help

2018-10-08_10h55_12.png (53.1 KB)

@miduha,

Thanks for the screenshot and sample code segment.

We may not execute your code segment as we are not sure about some objects/variables or data, etc. Please provide us your sample Excel files (input file (if any) and output file) and paste your complete sample code (runnable) to reproduce the issue on our end, we will check it soon. Also provide us a template file which should contain your category axis labels set as per your expectation, you may create your desired chart in MS Excel manually. This will help us really to evaluate your issue precisely to consequently figure it out soon.

Hi all, I plotted a graph of price versus date to show price changes across time using line chart. However I would like to only show the price as single dots i.e. to remove the lines connecting them. How would I be able to achieve that? I have tried with scatter chart, but the date on the axis is counted. Therefore the result is now what I have expected. Anybody have an idea on how to present the price versus date in a scatter plot form?
Plex Lucky Patcher Kodi

@mounia11,

Please create your desired chart in MS Excel manually based on your dataset in the worksheet, save the file and provide us here, we will check and guide you on how to accomplish the task via Aspose.Cells APIs.