1
我試圖用下面的X和Y值分別創建一個XY步驟圖表。不過,我幾個問題JFreechart - XY步驟圖表範圍和精度問題
- X的範圍和Y軸太粗晶,因此不顯示所有的數據圖上的點。我如何設置自己的範圍和精度?
- 我很困惑爲什麼X軸範圍顯示爲19:00:00:025。這與我添加的數據項不匹配。
代碼
final XYSeries series = new XYSeries("Random Data");
for (Coordinate c : coordinates)
{
series.add(c.x, c.y);
}
final XYSeriesCollection data = new XYSeriesCollection(series);
final JFreeChart chart = ChartFactory.createXYStepChart("XY Series Demo", "Latitude.before " + builder.getBeforeSimplifySize(),
"Longitude.after " + builder.getAfterSimplifySize(), data, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
XYSplineRenderer renderer = new XYSplineRenderer();
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, true);
renderer.setSeriesLinesVisible(1, false);
renderer.setSeriesShapesVisible(1, true);
plot.setRenderer(renderer);
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(1000, 1000));
setContentPane(chartPanel);
圖表圖像
數據(X,Y)
22.11845833328035, 21.7640694448683
22.118927777873147, 21.767827777730094
22.119402777883742, 21.771577777862547
22.11986111111111, 21.775330555703903
22.120297222137452, 21.779052777820162
22.1207694445716, 21.782777777777778
22.12122777779897, 21.786499999894037
22.121691666709054, 21.790222222010296
22.12238333331214, 21.793791667090524
22.124313889079623, 21.794461111492584
22.125488888952468, 21.792299999660916
22.126555555131702, 21.789572221967912
22.127716666327583, 21.786597222222223
22.128902777565852, 21.78352499999934
22.12928055551317, 21.780111111534964
22.12799444410536, 21.777344444062972
22.126263888676963, 21.77588611072964
22.1247833331426, 21.774636111259458
22.12351944446564, 21.77356666670905
22.12268888897366, 21.77209999985165
22.12205555544959, 21.770461111068723
22.12130833307902, 21.76895277765062
22.120730555587347, 21.76736111111111
22.12099722226461, 21.76573333316379
22.121925000084772, 21.765163888931273
22.122738889058432, 21.765847222010294
22.12294444455041, 21.767177777787047
22.12261111100515, 21.76862500005298
22.12194166660309, 21.76981666670905
22.120891666677263, 21.769922222296398
22.1201444445716, 21.76878055559264
22.119852777851953, 21.767180555562177
22.11962222231759, 21.76557499991523
22.11872777779897, 21.7645194445716
22.11762222223812, 21.76518888897366
22.117516666650772, 21.767211111121707
22.118702777756585, 21.7682361111376
22.120177777873145, 21.76688611111707
22.11994166665607, 21.764588889016046
22.118886111047534, 21.76399722205268
22.117880555523765, 21.763383333418105
22.11763333333863, 21.762047221925524
22.1186000000106, 21.760833333333334
22.1199277777142, 21.760519444147747
22.12074999994702, 21.75909999953376
22.120244444476235, 21.757891666624282
22.119372222158646, 21.757316666709052
22.118452777730095, 21.756691666709052
22.118022222254012, 21.75526111125946
22.11852222217454, 21.75406388892068
22.119263888994855, 21.75299444437027
22.119561111132306, 21.751650000015896
22.118716666698457, 21.75051666667064
22.117644444439147, 21.75164722217454
22.118058333396913, 21.7530166665713
22.118777777751287, 21.7538583334287
22.119766666624283, 21.754372222158644
22.12112777762943, 21.75402777777778
22.122155555619134, 21.75211111108462
22.121849999957615, 21.749758333630034
22.12074166668786, 21.748875000211928
22.119677777820165, 21.748883333206177
22.118625000052983, 21.748944444656374
22.11725277774864, 21.74952222188314
22.116283333036638, 21.751622222264608
22.116841666665344, 21.75414166662428
22.11861111111111, 21.75535000006358
22.12064722220103, 21.756391666730245
22.122597222328185, 21.757097222010295
22.124005555576748, 21.756288888719347
24.125258333418106, 23.755583333439297
26.12644444465637, 25.754974999957614
28.127694444656374, 27.754299999872842
29.129219444062976, 28.75346111112171
30.130997222264607, 29.752511111100514
31.13303055551317, 30.75141111108992
35.13517777774069, 34.75021666665872
36.13741666661368, 35.74901111072964
39.13970833354526, 38.747786110772026
40.14173888895247, 39.74669444402059
An [sscce](http://sscce.org/)會受到歡迎。 – trashgod