Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java DomainAxis中的数据太多,这是setTickUnit的另一种方式_Java_Jfreechart - Fatal编程技术网

Java DomainAxis中的数据太多,这是setTickUnit的另一种方式

Java DomainAxis中的数据太多,这是setTickUnit的另一种方式,java,jfreechart,Java,Jfreechart,我正在创建如下图表: DefaultCategoryDataset cumulativeResultData = new DefaultCategoryDataset(); DefaultCategoryDataset indexResultData = new DefaultCategoryDataset(); 然后在for循环中,使用cumulativeResultData.addValue向每个数据集添加数据 Cat

我正在创建如下图表:

            DefaultCategoryDataset cumulativeResultData = new DefaultCategoryDataset();
            DefaultCategoryDataset indexResultData = new DefaultCategoryDataset();
然后在for循环中,使用cumulativeResultData.addValue向每个数据集添加数据

            CategoryPlot plot = new CategoryPlot();
            plot.setDomainAxis(new CategoryAxis("Days"));
            plot.setRangeAxis(new NumberAxis("Result"));
            plot.setOrientation(PlotOrientation.VERTICAL);

            CategoryAxis domainAxis = plot.getDomainAxis();
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);


            LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(true, false);
            LineAndShapeRenderer renderer = new LineAndShapeRenderer(true,  false);

            plot.setRenderer(renderer);
            plot.setDataset(cumulativeResultData);
            ValueAxis rangeAxis2 = new NumberAxis("Index price");
            rangeAxis2.setRange(minRange - 1, maxRange + 1);
            plot.setRangeAxis(1, rangeAxis2);
            plot.setRenderer(1, renderer2);
            plot.setDataset(1, indexResultData);
            plot.mapDatasetToRangeAxis(1, 1);

            JFreeChart chart = new JFreeChart(plot);
但是我得到的不是我期望得到的,请看下面的图片。 domainAxis拥有大量数据,而且数据模糊。有什么办法修理这个吗?只有每个例如第20个元素显示在域轴上?

仅当x轴显示分类数据时,才应使用该类。看起来您有时间序列数据,为此,您可以使用带有x轴的类。还有一个类可以用于数据集