Skip to content
Snippets Groups Projects
Commit 121d4c2a authored by Tim Molter's avatar Tim Molter
Browse files

updated license header [ci skip]

parent 546f284d
No related branches found
No related tags found
No related merge requests found
Showing
with 158 additions and 186 deletions
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -20,9 +20,9 @@ import java.util.List; ...@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import com.xeiam.xchart.Chart; import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.StyleManager.ChartType; import com.xeiam.xchart.StyleManager.ChartType;
import com.xeiam.xchart.StyleManager.LegendPosition; import com.xeiam.xchart.StyleManager.LegendPosition;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.demo.charts.ExampleChart; import com.xeiam.xchart.demo.charts.ExampleChart;
/** /**
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,8 +23,8 @@ import com.xeiam.xchart.Chart; ...@@ -23,8 +23,8 @@ import com.xeiam.xchart.Chart;
import com.xeiam.xchart.ChartBuilder; import com.xeiam.xchart.ChartBuilder;
import com.xeiam.xchart.Series; import com.xeiam.xchart.Series;
import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SeriesMarker;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.StyleManager.ChartType; import com.xeiam.xchart.StyleManager.ChartType;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.demo.charts.ExampleChart; import com.xeiam.xchart.demo.charts.ExampleChart;
/** /**
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright (c) 2013 Knowmtech <http://knowmtech.com> * Copyright 2013 Xeiam LLC.
* *
* All rights reserved. No warranty, explicit or implicit, provided. In no event shall the author be liable for any claim or damages. * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* IMPORTANT: THIS CODE IS PROPRIETARY!!! ABSOLUTELY NO DUPLICATION OR DISTRIBUTION IS PERMITTED WITHOUT EXPRESS WRITTEN PERMISSION FROM: * You may obtain a copy of the License at
* M. ALEXANDER NUGENT CONSULTING 22B STACY RD, SANTA FE NM 87585 (505)-988-7016 i@alexnugent.name *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package com.xeiam.xchart; package com.xeiam.xchart;
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart; package com.xeiam.xchart;
...@@ -58,7 +52,8 @@ public class CSVImporter { ...@@ -58,7 +52,8 @@ public class CSVImporter {
Chart chart = null; Chart chart = null;
if (chartTheme != null) { if (chartTheme != null) {
chart = new Chart(width, height, chartTheme); chart = new Chart(width, height, chartTheme);
} else { }
else {
chart = new Chart(width, height); chart = new Chart(width, height);
} }
...@@ -71,7 +66,8 @@ public class CSVImporter { ...@@ -71,7 +66,8 @@ public class CSVImporter {
String[] xAndYData = null; String[] xAndYData = null;
if (dataOrientation == DataOrientation.Rows) { if (dataOrientation == DataOrientation.Rows) {
xAndYData = getSeriesDataFromCSVRows(csvFile); xAndYData = getSeriesDataFromCSVRows(csvFile);
} else { }
else {
xAndYData = getSeriesDataFromCSVColumns(csvFile); xAndYData = getSeriesDataFromCSVColumns(csvFile);
} }
chart.addSeries(csvFile.getName().substring(0, csvFile.getName().indexOf(".csv")), getAxisData(xAndYData[0]), getAxisData(xAndYData[1])); chart.addSeries(csvFile.getName().substring(0, csvFile.getName().indexOf(".csv")), getAxisData(xAndYData[0]), getAxisData(xAndYData[1]));
...@@ -220,7 +216,8 @@ public class CSVImporter { ...@@ -220,7 +216,8 @@ public class CSVImporter {
} }
} }
return filteredFiles.toArray(new File[filteredFiles.size()]); return filteredFiles.toArray(new File[filteredFiles.size()]);
} else { }
else {
System.out.println(dirName + " does not denote a valid directory!"); System.out.println(dirName + " does not denote a valid directory!");
return new File[0]; return new File[0];
} }
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart; package com.xeiam.xchart;
......
/** /**
* Copyright 2011-2013 Xeiam LLC. * Copyright 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart; package com.xeiam.xchart;
......
/** /**
* Copyright 2012 Xeiam LLC. * Copyright 2012 - 2013 Xeiam LLC.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -118,9 +118,11 @@ public class XChartPanel extends JPanel { ...@@ -118,9 +118,11 @@ public class XChartPanel extends JPanel {
try { try {
if (fileChooser.getFileFilter() == null) { if (fileChooser.getFileFilter() == null) {
BitmapEncoder.savePNG(chart, theFileToSave.getCanonicalPath().toString()); BitmapEncoder.savePNG(chart, theFileToSave.getCanonicalPath().toString());
} else if (fileChooser.getFileFilter().getDescription().equals("*.jpg,*.JPG")) { }
else if (fileChooser.getFileFilter().getDescription().equals("*.jpg,*.JPG")) {
BitmapEncoder.saveJPG(chart, theFileToSave.getCanonicalPath().toString() + ".jpg", 1.0f); BitmapEncoder.saveJPG(chart, theFileToSave.getCanonicalPath().toString() + ".jpg", 1.0f);
} else if (fileChooser.getFileFilter().getDescription().equals("*.png,*.PNG")) { }
else if (fileChooser.getFileFilter().getDescription().equals("*.png,*.PNG")) {
BitmapEncoder.savePNG(chart, theFileToSave.getCanonicalPath().toString() + ".png"); BitmapEncoder.savePNG(chart, theFileToSave.getCanonicalPath().toString() + ".png");
} }
} catch (IOException e) { } catch (IOException e) {
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart.internal; package com.xeiam.xchart.internal;
...@@ -63,7 +57,8 @@ public class Utils { ...@@ -63,7 +57,8 @@ public class Utils {
if (exponent > 0) { if (exponent > 0) {
return new BigDecimal(base).pow(exponent); return new BigDecimal(base).pow(exponent);
} else { }
else {
return BigDecimal.ONE.divide(new BigDecimal(base).pow(-exponent)); return BigDecimal.ONE.divide(new BigDecimal(base).pow(-exponent));
} }
} }
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart.internal.chartpart; package com.xeiam.xchart.internal.chartpart;
...@@ -74,9 +68,11 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator { ...@@ -74,9 +68,11 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator {
Object x = null; Object x = null;
if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) {
x = new BigDecimal(((Number) xItr.next()).doubleValue()); x = new BigDecimal(((Number) xItr.next()).doubleValue());
} else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { }
else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) {
x = new BigDecimal(((Date) xItr.next()).getTime()); x = new BigDecimal(((Date) xItr.next()).getTime());
} else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.String) { }
else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.String) {
x = xItr.next(); x = xItr.next();
} }
categories.add(x); categories.add(x);
...@@ -94,19 +90,22 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator { ...@@ -94,19 +90,22 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator {
if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) {
numberFormatter = new NumberFormatter(styleManager); numberFormatter = new NumberFormatter(styleManager);
} else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { }
else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) {
dateFormatter = new DateFormatter(chart.getStyleManager()); dateFormatter = new DateFormatter(chart.getStyleManager());
} }
int counter = 0; int counter = 0;
for (Object category : categories) { for (Object category : categories) {
if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Number) {
tickLabels.add(numberFormatter.formatNumber((BigDecimal) category)); tickLabels.add(numberFormatter.formatNumber((BigDecimal) category));
} else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { }
else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.Date) {
long span = Math.abs(maxValue.subtract(minValue).longValue()); // in data space long span = Math.abs(maxValue.subtract(minValue).longValue()); // in data space
long gridStepHint = (long) (span / (double) tickSpace * DEFAULT_TICK_MARK_STEP_HINT_X); long gridStepHint = (long) (span / (double) tickSpace * DEFAULT_TICK_MARK_STEP_HINT_X);
long timeUnit = dateFormatter.getTimeUnit(gridStepHint); long timeUnit = dateFormatter.getTimeUnit(gridStepHint);
tickLabels.add(dateFormatter.formatDate((BigDecimal) category, timeUnit)); tickLabels.add(dateFormatter.formatDate((BigDecimal) category, timeUnit));
} else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.String) { }
else if (chart.getAxisPair().getxAxis().getAxisType() == AxisType.String) {
tickLabels.add(category.toString()); tickLabels.add(category.toString());
} }
int tickLabelPosition = margin + firstPosition + gridStep * counter++; int tickLabelPosition = margin + firstPosition + gridStep * counter++;
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart.internal.chartpart; package com.xeiam.xchart.internal.chartpart;
...@@ -110,7 +104,8 @@ public abstract class AxisTickCalculator { ...@@ -110,7 +104,8 @@ public abstract class AxisTickCalculator {
BigDecimal firstPosition; BigDecimal firstPosition;
if (minValue.remainder(gridStep).doubleValue() <= 0.0) { if (minValue.remainder(gridStep).doubleValue() <= 0.0) {
firstPosition = minValue.subtract(minValue.remainder(gridStep)); firstPosition = minValue.subtract(minValue.remainder(gridStep));
} else { }
else {
firstPosition = minValue.subtract(minValue.remainder(gridStep)).add(gridStep); firstPosition = minValue.subtract(minValue.remainder(gridStep)).add(gridStep);
} }
return firstPosition; return firstPosition;
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart.internal.chartpart; package com.xeiam.xchart.internal.chartpart;
......
/** /**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com * Copyright 2013 Xeiam LLC.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Licensed under the Apache License, Version 2.0 (the "License");
* this software and associated documentation files (the "Software"), to deal in * you may not use this file except in compliance with the License.
* the Software without restriction, including without limitation the rights to * You may obtain a copy of the License at
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies *
* of the Software, and to permit persons to whom the Software is furnished to do * http://www.apache.org/licenses/LICENSE-2.0
* so, subject to the following conditions: *
* * Unless required by applicable law or agreed to in writing, software
* The above copyright notice and this permission notice shall be included in all * distributed under the License is distributed on an "AS IS" BASIS,
* copies or substantial portions of the Software. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * limitations under the License.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
package com.xeiam.xchart.internal.chartpart; package com.xeiam.xchart.internal.chartpart;
...@@ -119,13 +113,14 @@ public class AxisTickLogarithmicCalculator extends AxisTickCalculator { ...@@ -119,13 +113,14 @@ public class AxisTickLogarithmicCalculator extends AxisTickCalculator {
// only add labels for the decades // only add labels for the decades
if (Math.log10(j.doubleValue()) % 1 == 0.0) { if (Math.log10(j.doubleValue()) % 1 == 0.0) {
tickLabels.add(numberFormatter.formatNumber(j)); tickLabels.add(numberFormatter.formatNumber(j));
} else { }
else {
tickLabels.add(null); tickLabels.add(null);
} }
// add all the tick marks though // add all the tick marks though
int tickLabelPosition = (int) (margin + (Math.log10(j.doubleValue()) - Math.log10(minValue.doubleValue())) / (Math.log10(maxValue.doubleValue()) - Math.log10(minValue.doubleValue())) int tickLabelPosition =
* tickSpace); (int) (margin + (Math.log10(j.doubleValue()) - Math.log10(minValue.doubleValue())) / (Math.log10(maxValue.doubleValue()) - Math.log10(minValue.doubleValue())) * tickSpace);
tickLocations.add(tickLabelPosition); tickLocations.add(tickLabelPosition);
} }
tickStep = tickStep.multiply(Utils.pow(10, 1)); tickStep = tickStep.multiply(Utils.pow(10, 1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment