首页 \ 问答 \ JFreechart - XY步骤图范围和精度问题(JFreechart - XY Step Chart range and precision issues)

JFreechart - XY步骤图范围和精度问题(JFreechart - XY Step Chart range and precision issues)

我正在尝试分别使用下面的X和Y值创建一个XY步骤图。 但是,我几乎没有问题

  1. X轴和Y轴的范围太粗糙 ,因此未显示图表上的所有数据点。 如何自己设定范围和精度?
  2. 我很困惑为什么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

I am trying to create a XY step chart with the below X and Y values respectively. However, I've few issues

  1. the ranges for X and Y axis are too coarse grained and hence not showing all the data points on the graph. How can I set the range and precision myself?
  2. I am confused on why the X axis ranges are displayed like 19:00:00:025. This is not matching the data items i am adding.

Code

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);

Chart Image

enter image description here

Data (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

原文:https://stackoverflow.com/questions/8264135
更新时间:2022-07-16 07:07

最满意答案

有了LIKE你有三种方法。

1)如果它包含相同顺序的所有单词(关键词:一架飞机)

SELECT * FROM descriptions WHERE description LIKE('%One airplane%');

2)如果它包含所有单词但其他顺序无关紧要

SELECT * FROM descriptions WHERE description LIKE('%One%') AND description LIKE('% airplane%');

3)如果它包含一些单词

SELECT * FROM descriptions WHERE description LIKE('%One%') OR description LIKE('% airplane%');

现在,您可以选择对搜索的严格程度。

如果您想使用第二个或第三个实现,您将使用“space”将关键字分割为字符串,并为数组中的每个项添加类似的内容。


With LIKE you have three approaches.

1) If it contains all the words in the same order (Keywords: One airplane)

SELECT * FROM descriptions WHERE description LIKE('%One airplane%');

2) If it contains all the words but ther order doesn't matter

SELECT * FROM descriptions WHERE description LIKE('%One%') AND description LIKE('% airplane%');

3) If it contains some of the words

SELECT * FROM descriptions WHERE description LIKE('%One%') OR description LIKE('% airplane%');

Now you can choose how strict do you want to be with the searches.

If you want to go with the second or third implementation you will be spliting the string with the keywords by "space" and adding a like for each item in the array.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)