├── .travis.yml ├── src ├── main │ └── java │ │ └── de │ │ └── stekoe │ │ └── amcharts │ │ ├── addition │ │ ├── Position.java │ │ ├── Function.java │ │ ├── Listener.java │ │ ├── ColorSerialiser.java │ │ └── Color.java │ │ ├── helper │ │ ├── Status.java │ │ └── AmChartsWebsiteExtractor.java │ │ ├── extractor │ │ └── AmChartsWebsiteExtractorRunner.java │ │ ├── AmRadarChart.java │ │ ├── SerialDataItem.java │ │ ├── Title.java │ │ ├── AmXYChart.java │ │ ├── Image.java │ │ ├── Label.java │ │ ├── Slice.java │ │ ├── GaugeBand.java │ │ ├── AmCharts.java │ │ ├── GaugeArrow.java │ │ ├── AmCoordinateChart.java │ │ ├── GraphDataItem.java │ │ ├── AmFunnelChart.java │ │ ├── AmGanttChart.java │ │ ├── AmPieChart.java │ │ ├── AmAngularGauge.java │ │ ├── TrendLine.java │ │ ├── CategoryAxis.java │ │ ├── AmSerialChart.java │ │ ├── Guide.java │ │ ├── AmBalloon.java │ │ ├── AmRectangularChart.java │ │ ├── ChartCursor.java │ │ └── GaugeAxis.java └── test │ └── java │ └── de │ └── stekoe │ └── amcharts │ ├── addition │ └── ListenerTest.java │ └── AmChartSerializationTest.java ├── LICENSE.md ├── .gitignore ├── README.md └── pom.xml /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/addition/Position.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | public enum Position { 4 | top, bottom, left, right; 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/helper/Status.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.helper; 2 | 3 | public enum Status { 4 | DO_NOT_OVERWRITE, SUCCESS, ERROR 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/addition/Function.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Function implements Serializable { 6 | private String function; 7 | 8 | public String getFunction() { 9 | return function; 10 | } 11 | 12 | public void setFunction(String function) { 13 | this.function = function; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/addition/Listener.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | public class Listener { 4 | 5 | private String event; 6 | private String method; 7 | 8 | public void setEvent(String event) { 9 | this.event = event; 10 | } 11 | 12 | public String getEvent() { 13 | return event; 14 | } 15 | 16 | 17 | public void setMethod(String method) { 18 | this.method = method; 19 | } 20 | 21 | public String getMethod() { 22 | return method; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/addition/ColorSerialiser.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import com.google.gson.JsonSerializationContext; 6 | import com.google.gson.JsonSerializer; 7 | 8 | import java.lang.reflect.Type; 9 | 10 | public class ColorSerialiser implements JsonSerializer { 11 | 12 | public JsonElement serialize(Color src, Type typeOfSrc, JsonSerializationContext context) { 13 | return new JsonPrimitive(src.toString()); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/addition/Color.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Color implements Serializable { 6 | 7 | public static final Color BLACK = create("000000"); 8 | public static final Color WHITE = create("FFFFFF"); 9 | 10 | private String colorHexVal; 11 | 12 | private Color() { 13 | } 14 | 15 | ; 16 | 17 | private Color(String colorHexVal) { 18 | this.colorHexVal = colorHexVal; 19 | } 20 | 21 | public static Color create(String colorHexVal) { 22 | return new Color(colorHexVal); 23 | } 24 | 25 | // Append # to color values as we have hex values 26 | @Override 27 | public String toString() { 28 | return "#" + this.colorHexVal; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/de/stekoe/amcharts/addition/ListenerTest.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.addition; 2 | 3 | import com.github.julman99.gsonfire.GsonFireBuilder; 4 | import com.google.gson.Gson; 5 | import org.junit.Test; 6 | 7 | import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath; 8 | import static com.jayway.jsonpath.matchers.JsonPathMatchers.isJson; 9 | import static org.hamcrest.CoreMatchers.equalTo; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class ListenerTest { 13 | GsonFireBuilder builder = new GsonFireBuilder().enableExposeMethodResult(); 14 | Gson gson = builder.createGson(); 15 | 16 | @Test 17 | public void testName() throws Exception { 18 | Listener listener = new Listener(); 19 | listener.setEvent("clickBand"); 20 | listener.setMethod("handleClick"); 21 | 22 | String json = gson.toJson(listener); 23 | assertThat(json, hasJsonPath("$.event", equalTo("clickBand"))); 24 | assertThat(json, hasJsonPath("$.method", equalTo("handleClick"))); 25 | } 26 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Stephan Köninger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/test/java/de/stekoe/amcharts/AmChartSerializationTest.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import de.stekoe.amcharts.addition.Color; 6 | import de.stekoe.amcharts.addition.ColorSerialiser; 7 | import org.hamcrest.CoreMatchers; 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath; 12 | import static org.hamcrest.MatcherAssert.assertThat; 13 | import static org.hamcrest.core.IsEqual.equalTo; 14 | 15 | public class AmChartSerializationTest { 16 | @Test 17 | public void jsonSerialization() throws Exception { 18 | AmChart pieChart = new AmPieChart(); 19 | pieChart.setBorderColor(Color.BLACK); 20 | pieChart.setFontSize(23.0); 21 | 22 | Gson gson = new Gson(); 23 | GsonBuilder gsonBuilder = new GsonBuilder(); 24 | gsonBuilder.registerTypeAdapter(Color.class, new ColorSerialiser()); 25 | 26 | 27 | String json = gson.toJson(pieChart); 28 | Assert.assertThat(json, hasJsonPath("$.borderColor.colorHexVal", equalTo("000000"))); 29 | Assert.assertThat(json, hasJsonPath("$.fontSize", equalTo(23.0))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/extractor/AmChartsWebsiteExtractorRunner.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.extractor; 2 | 3 | import de.stekoe.amcharts.helper.AmChartsWebsiteExtractor; 4 | import org.jsoup.Jsoup; 5 | import org.jsoup.nodes.Document; 6 | import org.jsoup.nodes.Element; 7 | import org.jsoup.select.Elements; 8 | 9 | import java.io.IOException; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class AmChartsWebsiteExtractorRunner { 14 | public static void main(String[] args) throws IOException { 15 | Document doc = Jsoup.connect("http://docs.amcharts.com/3/javascriptcharts/") 16 | .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") 17 | .get(); 18 | 19 | List components = retrieveComponents(doc); 20 | 21 | for (String component : components) { 22 | new AmChartsWebsiteExtractor().run(component); 23 | } 24 | 25 | System.out.println("Fin!"); 26 | } 27 | 28 | static List retrieveComponents(Document doc) { 29 | List components = new ArrayList(); 30 | Elements navListItems = doc.select(".nav.nav-list.left li"); 31 | for (Element element : navListItems) { 32 | String attr = element.attr("class"); 33 | if (!attr.equals("search-group") && !attr.equals("nav-header")) { 34 | components.add(element.text()); 35 | } 36 | } 37 | return components; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | src/main/resources/java/ 4 | 5 | ### Eclipse ### 6 | *.pydevproject 7 | .metadata 8 | .gradle 9 | .classpath 10 | bin/ 11 | tmp/ 12 | *.tmp 13 | *.bak 14 | *.swp 15 | *~.nib 16 | local.properties 17 | .settings/ 18 | .loadpath 19 | .project 20 | 21 | # External tool builders 22 | .externalToolBuilders/ 23 | 24 | # Locally stored "Eclipse launch configurations" 25 | *.launch 26 | 27 | # CDT-specific 28 | .cproject 29 | 30 | # PDT-specific 31 | .buildpath 32 | 33 | # sbteclipse plugin 34 | .target 35 | 36 | # TeXlipse plugin 37 | .texlipse 38 | 39 | 40 | ### Intellij ### 41 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 42 | 43 | ## Directory-based project format 44 | .idea/ 45 | # if you remove the above rule, at least ignore user-specific stuff: 46 | # .idea/workspace.xml 47 | # .idea/tasks.xml 48 | # and these sensitive or high-churn files: 49 | # .idea/dataSources.ids 50 | # .idea/dataSources.xml 51 | # .idea/sqlDataSources.xml 52 | # .idea/dynamic.xml 53 | 54 | ## File-based project format 55 | *.ipr 56 | *.iws 57 | *.iml 58 | 59 | ## Additional for IntelliJ 60 | out/ 61 | 62 | # generated by mpeltonen/sbt-idea plugin 63 | .idea_modules/ 64 | 65 | # generated by JIRA plugin 66 | atlassian-ide-plugin.xml 67 | 68 | # generated by Crashlytics plugin (for Android Studio and Intellij) 69 | com_crashlytics_export_strings.xml 70 | 71 | 72 | ### Maven ### 73 | target/ 74 | pom.xml.tag 75 | pom.xml.releaseBackup 76 | pom.xml.versionsBackup 77 | pom.xml.next 78 | release.properties 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # amcharts-java [![Build Status](https://travis-ci.org/SteKoe/amcharts-java.svg?branch=3.15.1)](https://travis-ci.org/SteKoe/amcharts-java) 2 | 3 | Java API for the awesome Charts Package amChartsv3 (http://www.amcharts.com). 4 | The Version of this API corresponds to the Version of amCharts. 5 | 6 | ## How to serialise to JSON 7 | To serialize the AmCharts to JSON, please use GSON from google/gson. The classes are ready to be consumed by GSON as done in the following code snippet. 8 | 9 | ```java 10 | import de.stekoe.amcharts.addition.Color; 11 | import de.stekoe.amcharts.addition.ColorSerialiser; 12 | 13 | Gson gson = new Gson(); 14 | GsonBuilder gsonBuilder = new GsonBuilder(); 15 | gsonBuilder.registerTypeAdapter(Color.class, new ColorSerialiser()); 16 | gson = gsonBuilder.create(); 17 | 18 | AmChart chart = new AmRadarChart(); 19 | String json = gson.toJson(chart); 20 | ``` 21 | 22 | ## Example JSON Output 23 | 24 | The following code is based on an example from the website of amCharts: 25 |
26 | {
27 |     "type": "serial",
28 |     "theme": "none",
29 |     "dataProvider": [{
30 |         "country": "USA",
31 |         "visits": 2025
32 |     }],
33 |     "valueAxes": [{
34 |         "gridColor":"#FFFFFF",
35 | 		"gridAlpha": 0.2,
36 | 		"dashLength": 0
37 |     }],
38 |     "gridAboveGraphs": true,
39 |     "startDuration": 1,
40 |     "graphs": [{
41 |         "balloonText": "[[category]]: [[value]]",
42 |         "fillAlphas": 0.8,
43 |         "lineAlpha": 0.2,
44 |         "type": "column",
45 |         "valueField": "visits"		
46 |     }],
47 |     "chartCursor": {
48 |         "categoryBalloonEnabled": false,
49 |         "cursorAlpha": 0,
50 |         "zoomable": false
51 |     },
52 |     "categoryField": "country",
53 |     "categoryAxis": {
54 |         "gridPosition": "start",
55 |         "gridAlpha": 0
56 |     }
57 | }
58 | 
59 | 60 | The same definition using this Java-API 61 | 62 |
63 | AmSerialChart chart = new AmSerialChart();
64 | chart.setType("serial");
65 | chart.setTheme("none");
66 | 
67 | 
68 | chart.setValueAxes();
69 | chart.setGridAboveGraphs(true);
70 | chart.setStartDuration(1);
71 | chart.setGraphs(getGraphs());
72 | chart.setChartCursor(getChartCursor());
73 | chart.setCategoryField("choice");
74 | chart.setCategoryAxis(getCategoryAxis());
75 | 
76 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmRadarChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | /** 4 | * Extension for AmCoordinateChart to create radar/polar charts. 5 | */ 6 | 7 | public class AmRadarChart extends AmCoordinateChart { 8 | private String categoryField; 9 | private Double marginBottom; 10 | private Double marginLeft; 11 | private Double marginRight; 12 | private Double marginTop; 13 | private String radius; 14 | 15 | /** 16 | * @param categoryField Field in your data provider containing categories. 17 | * @return AmRadarChart 18 | */ 19 | public AmRadarChart setCategoryField(String categoryField) { 20 | this.categoryField = categoryField; 21 | return this; 22 | } 23 | 24 | public String getCategoryField() { 25 | return categoryField; 26 | } 27 | 28 | /** 29 | * @param marginBottom Bottom margin of the chart. 30 | * @return AmRadarChart 31 | */ 32 | public AmRadarChart setMarginBottom(double marginBottom) { 33 | this.marginBottom = marginBottom; 34 | return this; 35 | } 36 | 37 | public Double getMarginBottom() { 38 | return marginBottom; 39 | } 40 | 41 | /** 42 | * @param marginLeft Left margin of the chart. 43 | * @return AmRadarChart 44 | */ 45 | public AmRadarChart setMarginLeft(double marginLeft) { 46 | this.marginLeft = marginLeft; 47 | return this; 48 | } 49 | 50 | public Double getMarginLeft() { 51 | return marginLeft; 52 | } 53 | 54 | /** 55 | * @param marginRight Right margin of the chart. 56 | * @return AmRadarChart 57 | */ 58 | public AmRadarChart setMarginRight(double marginRight) { 59 | this.marginRight = marginRight; 60 | return this; 61 | } 62 | 63 | public Double getMarginRight() { 64 | return marginRight; 65 | } 66 | 67 | /** 68 | * @param marginTop Top margin of the chart. 69 | * @return AmRadarChart 70 | */ 71 | public AmRadarChart setMarginTop(double marginTop) { 72 | this.marginTop = marginTop; 73 | return this; 74 | } 75 | 76 | public Double getMarginTop() { 77 | return marginTop; 78 | } 79 | 80 | /** 81 | * @param radius Radius of a radar. 82 | * @return AmRadarChart 83 | */ 84 | public AmRadarChart setRadius(String radius) { 85 | this.radius = radius; 86 | return this; 87 | } 88 | 89 | public String getRadius() { 90 | return radius; 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | de.stekoe 5 | amcharts 6 | 3.21.13-SNAPSHOT 7 | jar 8 | amcharts 9 | http://maven.apache.org 10 | 11 | UTF-8 12 | 13 | 14 | 15 | julman99-github 16 | https://raw.github.com/julman99/mvn-repo/master 17 | 18 | 19 | 20 | 21 | junit 22 | junit 23 | 4.11 24 | test 25 | 26 | 27 | commons-io 28 | commons-io 29 | 2.4 30 | 31 | 32 | org.jsoup 33 | jsoup 34 | 1.7.3 35 | 36 | 37 | org.skyscreamer 38 | jsonassert 39 | 1.2.3 40 | 41 | 42 | com.google.code.gson 43 | gson 44 | 2.2.4 45 | 46 | 47 | com.github.julman99 48 | gson-fire 49 | 0.8.1 50 | 51 | 52 | com.jayway.jsonpath 53 | json-path 54 | 2.3.0 55 | 56 | 57 | com.jayway.jsonpath 58 | json-path-assert 59 | 2.2.0 60 | 61 | 62 | org.projectlombok 63 | lombok 64 | 1.16.20 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/SerialDataItem.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * SerialDataItem holds all the information about each series. When working with a chart, 7 | * you do not create SerialDataItem objects or change it's properties directly. Consider 8 | * properties of a SerialDataItem read-only - change values in chart's data provider 9 | * if you need to. When serial chart parses dataProvider, it generates "chartData" array. 10 | * Objects of this array are SerialDataItem objects. 11 | */ 12 | 13 | public class SerialDataItem implements Serializable { 14 | private Object axes; 15 | private String category; 16 | private Object dataContext; 17 | private Double time; 18 | private Double x; 19 | 20 | /** 21 | * @param axes You can access each GraphDataItem using this object. The data structure is: graphDataItem 22 | * = serialDataItem.axes[axisId].graphs[graphId]. 23 | * @return SerialDataItem 24 | */ 25 | public SerialDataItem setAxes(Object axes) { 26 | this.axes = axes; 27 | return this; 28 | } 29 | 30 | public Object getAxes() { 31 | return axes; 32 | } 33 | 34 | /** 35 | * @param category category value. String if parseDates is false, Date if true. 36 | * @return SerialDataItem 37 | */ 38 | public SerialDataItem setCategory(String category) { 39 | this.category = category; 40 | return this; 41 | } 42 | 43 | public String getCategory() { 44 | return category; 45 | } 46 | 47 | /** 48 | * @param dataContext Reference to original data object, from dataProvider. 49 | * @return SerialDataItem 50 | */ 51 | public SerialDataItem setDataContext(Object dataContext) { 52 | this.dataContext = dataContext; 53 | return this; 54 | } 55 | 56 | public Object getDataContext() { 57 | return dataContext; 58 | } 59 | 60 | /** 61 | * @param time Time stamp of a series date. Avalable only if parseDates property of CategoryAxis 62 | * is set to true. 63 | * @return SerialDataItem 64 | */ 65 | public SerialDataItem setTime(double time) { 66 | this.time = time; 67 | return this; 68 | } 69 | 70 | public Double getTime() { 71 | return time; 72 | } 73 | 74 | /** 75 | * @param x *Coordinate (horizontal or vertical, depends on chart's rotate property) of the series. 76 | * @return SerialDataItem 77 | */ 78 | public SerialDataItem setX(double x) { 79 | this.x = x; 80 | return this; 81 | } 82 | 83 | public Double getX() { 84 | return x; 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/Title.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Creates a title on above the chart, multiple can be assigned. 9 | */ 10 | 11 | public class Title implements Serializable { 12 | private Double alpha; 13 | private Boolean bold; 14 | private Color color; 15 | private String id; 16 | private Double size; 17 | private Double tabIndex; 18 | private String text; 19 | 20 | /** 21 | * @param alpha Opacity of a title. 22 | * @return Title 23 | */ 24 | public Title setAlpha(double alpha) { 25 | this.alpha = alpha; 26 | return this; 27 | } 28 | 29 | public Double getAlpha() { 30 | return alpha; 31 | } 32 | 33 | /** 34 | * @param bold Specifies if title should be bold or not. 35 | * @return Title 36 | */ 37 | public Title setBold(boolean bold) { 38 | this.bold = bold; 39 | return this; 40 | } 41 | 42 | public Boolean getBold() { 43 | return bold; 44 | } 45 | 46 | /** 47 | * @param color Text color of a title. 48 | * @return Title 49 | */ 50 | public Title setColor(Color color) { 51 | this.color = color; 52 | return this; 53 | } 54 | 55 | public Color getColor() { 56 | return color; 57 | } 58 | 59 | /** 60 | * @param id Unique id of a Title. You don't need to set it, unless you want to. 61 | * @return Title 62 | */ 63 | public Title setId(String id) { 64 | this.id = id; 65 | return this; 66 | } 67 | 68 | public String getId() { 69 | return id; 70 | } 71 | 72 | /** 73 | * @param size Text size of a title. 74 | * @return Title 75 | */ 76 | public Title setSize(double size) { 77 | this.size = size; 78 | return this; 79 | } 80 | 81 | public Double getSize() { 82 | return size; 83 | } 84 | 85 | /** 86 | * @param tabIndex In case you set it to some number, the chart will set focus on the title when user 87 | * clicks tab key. When a focus is set, screen readers like NVDA Screen reader will 88 | * read the title. Note, not all browsers and readers support this. 89 | * @return Title 90 | */ 91 | public Title setTabIndex(double tabIndex) { 92 | this.tabIndex = tabIndex; 93 | return this; 94 | } 95 | 96 | public Double getTabIndex() { 97 | return tabIndex; 98 | } 99 | 100 | /** 101 | * @param text Text of a title. 102 | * @return Title 103 | */ 104 | public Title setText(String text) { 105 | this.text = text; 106 | return this; 107 | } 108 | 109 | public String getText() { 110 | return text; 111 | } 112 | 113 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmXYChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | /** 4 | * Extension for AmRectangularChart to create XY/bubble/scatter charts. The charts support 5 | * multiple axes with simple or logarithmic scales. 6 | */ 7 | 8 | public class AmXYChart extends AmRectangularChart { 9 | private String dataDateFormat; 10 | private Boolean hideXScrollbar; 11 | private Boolean hideYScrollbar; 12 | private Double maxValue; 13 | private Double maxZoomFactor; 14 | private Double minValue; 15 | 16 | /** 17 | * @param dataDateFormat In case you have date-based value axis in your XY chart, you can specify your corresponding 18 | * values as strings. In that case you will need to set this setting to whatever format 19 | * your are using for date/time. Check this page for available formats. Please note 20 | * that two-digit years (YY) as well as literal month names (MMM) are NOT supported 21 | * in this setting. 22 | * @return AmXYChart 23 | */ 24 | public AmXYChart setDataDateFormat(String dataDateFormat) { 25 | this.dataDateFormat = dataDateFormat; 26 | return this; 27 | } 28 | 29 | public String getDataDateFormat() { 30 | return dataDateFormat; 31 | } 32 | 33 | /** 34 | * @param hideXScrollbar Specifies if Scrollbar of X axis (horizontal) should be hidden. 35 | * @return AmXYChart 36 | */ 37 | public AmXYChart setHideXScrollbar(boolean hideXScrollbar) { 38 | this.hideXScrollbar = hideXScrollbar; 39 | return this; 40 | } 41 | 42 | public Boolean getHideXScrollbar() { 43 | return hideXScrollbar; 44 | } 45 | 46 | /** 47 | * @param hideYScrollbar Specifies if Scrollbar of Y axis (vertical) should be hidden. 48 | * @return AmXYChart 49 | */ 50 | public AmXYChart setHideYScrollbar(boolean hideYScrollbar) { 51 | this.hideYScrollbar = hideYScrollbar; 52 | return this; 53 | } 54 | 55 | public Boolean getHideYScrollbar() { 56 | return hideYScrollbar; 57 | } 58 | 59 | /** 60 | * @param maxValue These can be used to adjust size/scale of bubbles. If these properties are not set, 61 | * the bubble with smallest value will be of minBulletSize and bubble with biggest value 62 | * will be of maxBulletSize. However, you might want bubble size to change relative 63 | * to 0 or some other value. In this case you can use minValue and maxValue properties. 64 | * Note, if you use these two settings, you might also want to set minBulletSize to 65 | * 0. 66 | * @return AmXYChart 67 | */ 68 | public AmXYChart setMaxValue(double maxValue) { 69 | this.maxValue = maxValue; 70 | return this; 71 | } 72 | 73 | public Double getMaxValue() { 74 | return maxValue; 75 | } 76 | 77 | /** 78 | * @param maxZoomFactor Maximum zoom factor of the chart. 79 | * @return AmXYChart 80 | */ 81 | public AmXYChart setMaxZoomFactor(double maxZoomFactor) { 82 | this.maxZoomFactor = maxZoomFactor; 83 | return this; 84 | } 85 | 86 | public Double getMaxZoomFactor() { 87 | return maxZoomFactor; 88 | } 89 | 90 | /** 91 | * @param minValue These can be used to adjust size/scale of bubbles. If these properties are not set, 92 | * the bubble with smallest value will be of minBulletSize and bubble with biggest value 93 | * will be of maxBulletSize. However, you might want bubble size to change relative 94 | * to 0 or some other value. In this case you can use minValue and maxValue properties. 95 | * Note, if you use these two settings, you might also want to set minBulletSize to 96 | * 0. 97 | * @return AmXYChart 98 | */ 99 | public AmXYChart setMinValue(double minValue) { 100 | this.minValue = minValue; 101 | return this; 102 | } 103 | 104 | public Double getMinValue() { 105 | return minValue; 106 | } 107 | 108 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/Image.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Image is used to add images to the end/start of trend lines. Allows you to display 9 | * image anywhere on chart's plot area. 10 | */ 11 | 12 | public class Image implements Serializable { 13 | private Color balloonColor; 14 | private String balloonText; 15 | private Color color; 16 | private Double height; 17 | private Double offsetX; 18 | private Double offsetY; 19 | private Color outlineColor; 20 | private Double rotation; 21 | private String svgPath; 22 | private String url; 23 | private Double width; 24 | 25 | /** 26 | * @param balloonColor Roll-over balloon color. 27 | * @return Image 28 | */ 29 | public Image setBalloonColor(Color balloonColor) { 30 | this.balloonColor = balloonColor; 31 | return this; 32 | } 33 | 34 | public Color getBalloonColor() { 35 | return balloonColor; 36 | } 37 | 38 | /** 39 | * @param balloonText Roll-over text. 40 | * @return Image 41 | */ 42 | public Image setBalloonText(String balloonText) { 43 | this.balloonText = balloonText; 44 | return this; 45 | } 46 | 47 | public String getBalloonText() { 48 | return balloonText; 49 | } 50 | 51 | /** 52 | * @param color Color of an image. Works only if an image is generated using SVG path (using svgPath 53 | * property on an Image) 54 | * @return Image 55 | */ 56 | public Image setColor(Color color) { 57 | this.color = color; 58 | return this; 59 | } 60 | 61 | public Color getColor() { 62 | return color; 63 | } 64 | 65 | /** 66 | * @param height Height of an image. 67 | * @return Image 68 | */ 69 | public Image setHeight(double height) { 70 | this.height = height; 71 | return this; 72 | } 73 | 74 | public Double getHeight() { 75 | return height; 76 | } 77 | 78 | /** 79 | * @param offsetX Horizontal offset. 80 | * @return Image 81 | */ 82 | public Image setOffsetX(double offsetX) { 83 | this.offsetX = offsetX; 84 | return this; 85 | } 86 | 87 | public Double getOffsetX() { 88 | return offsetX; 89 | } 90 | 91 | /** 92 | * @param offsetY Vertical offset. 93 | * @return Image 94 | */ 95 | public Image setOffsetY(double offsetY) { 96 | this.offsetY = offsetY; 97 | return this; 98 | } 99 | 100 | public Double getOffsetY() { 101 | return offsetY; 102 | } 103 | 104 | /** 105 | * @param outlineColor Color of image outline. Works only if an image is generated using SVG path (using 106 | * svgPath property on an Image) 107 | * @return Image 108 | */ 109 | public Image setOutlineColor(Color outlineColor) { 110 | this.outlineColor = outlineColor; 111 | return this; 112 | } 113 | 114 | public Color getOutlineColor() { 115 | return outlineColor; 116 | } 117 | 118 | /** 119 | * @param rotation Rotation of an image. 120 | * @return Image 121 | */ 122 | public Image setRotation(double rotation) { 123 | this.rotation = rotation; 124 | return this; 125 | } 126 | 127 | public Double getRotation() { 128 | return rotation; 129 | } 130 | 131 | /** 132 | * @param svgPath Svg path of an image. Will not work with IE8. 133 | * @return Image 134 | */ 135 | public Image setSvgPath(String svgPath) { 136 | this.svgPath = svgPath; 137 | return this; 138 | } 139 | 140 | public String getSvgPath() { 141 | return svgPath; 142 | } 143 | 144 | /** 145 | * @param url Url of an image. 146 | * @return Image 147 | */ 148 | public Image setUrl(String url) { 149 | this.url = url; 150 | return this; 151 | } 152 | 153 | public String getUrl() { 154 | return url; 155 | } 156 | 157 | /** 158 | * @param width Width on an image. 159 | * @return Image 160 | */ 161 | public Image setWidth(double width) { 162 | this.width = width; 163 | return this; 164 | } 165 | 166 | public Double getWidth() { 167 | return width; 168 | } 169 | 170 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/Label.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * *Creates a label on the chart which can be placed anywhere, multiple can be assigned. 9 | */ 10 | 11 | public class Label implements Serializable { 12 | private String align; 13 | private Double alpha; 14 | private Boolean bold; 15 | private Color color; 16 | private String id; 17 | private Double rotation; 18 | private Double size; 19 | private Double tabIndex; 20 | private String text; 21 | private String url; 22 | private String x; 23 | private String y; 24 | 25 | /** 26 | * @param align 27 | * @return Label 28 | */ 29 | public Label setAlign(String align) { 30 | this.align = align; 31 | return this; 32 | } 33 | 34 | public String getAlign() { 35 | return align; 36 | } 37 | 38 | /** 39 | * @param alpha 40 | * @return Label 41 | */ 42 | public Label setAlpha(double alpha) { 43 | this.alpha = alpha; 44 | return this; 45 | } 46 | 47 | public Double getAlpha() { 48 | return alpha; 49 | } 50 | 51 | /** 52 | * @param bold Specifies if label is bold or not. 53 | * @return Label 54 | */ 55 | public Label setBold(boolean bold) { 56 | this.bold = bold; 57 | return this; 58 | } 59 | 60 | public Boolean getBold() { 61 | return bold; 62 | } 63 | 64 | /** 65 | * @param color Color of a label. 66 | * @return Label 67 | */ 68 | public Label setColor(Color color) { 69 | this.color = color; 70 | return this; 71 | } 72 | 73 | public Color getColor() { 74 | return color; 75 | } 76 | 77 | /** 78 | * @param id Unique id of a Label. You don't need to set it, unless you want to. 79 | * @return Label 80 | */ 81 | public Label setId(String id) { 82 | this.id = id; 83 | return this; 84 | } 85 | 86 | public String getId() { 87 | return id; 88 | } 89 | 90 | /** 91 | * @param rotation Rotation angle. 92 | * @return Label 93 | */ 94 | public Label setRotation(double rotation) { 95 | this.rotation = rotation; 96 | return this; 97 | } 98 | 99 | public Double getRotation() { 100 | return rotation; 101 | } 102 | 103 | /** 104 | * @param size Text size. 105 | * @return Label 106 | */ 107 | public Label setSize(double size) { 108 | this.size = size; 109 | return this; 110 | } 111 | 112 | public Double getSize() { 113 | return size; 114 | } 115 | 116 | /** 117 | * @param tabIndex In case you set it to some number, the chart will set focus on the label when user 118 | * clicks tab key. When a focus is set, screen readers like NVDA Screen reader will 119 | * read the title. Note, not all browsers and readers support this. 120 | * @return Label 121 | */ 122 | public Label setTabIndex(double tabIndex) { 123 | this.tabIndex = tabIndex; 124 | return this; 125 | } 126 | 127 | public Double getTabIndex() { 128 | return tabIndex; 129 | } 130 | 131 | /** 132 | * @param text Text of a label. 133 | * @return Label 134 | */ 135 | public Label setText(String text) { 136 | this.text = text; 137 | return this; 138 | } 139 | 140 | public String getText() { 141 | return text; 142 | } 143 | 144 | /** 145 | * @param url URL which will be access if user clicks on a label. 146 | * @return Label 147 | */ 148 | public Label setUrl(String url) { 149 | this.url = url; 150 | return this; 151 | } 152 | 153 | public String getUrl() { 154 | return url; 155 | } 156 | 157 | /** 158 | * @param x X position of a label. 159 | * @return Label 160 | */ 161 | public Label setX(String x) { 162 | this.x = x; 163 | return this; 164 | } 165 | 166 | public String getX() { 167 | return x; 168 | } 169 | 170 | /** 171 | * @param y y position of a label. 172 | * @return Label 173 | */ 174 | public Label setY(String y) { 175 | this.y = y; 176 | return this; 177 | } 178 | 179 | public String getY() { 180 | return y; 181 | } 182 | 183 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/Slice.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Slice is an item of AmPieChart's chartData Array and holds all the information about 9 | * the slice. When working with a pie chart, you do not create slices or change it's 10 | * properties directly, instead you set array of data using dataProvider property. Consider 11 | * properties of a Slice read-only - change values in chart's data provider if you need 12 | * to. 13 | */ 14 | 15 | public class Slice implements Serializable { 16 | private Double alpha; 17 | private Color color; 18 | private Object dataContext; 19 | private String description; 20 | private Boolean hidden; 21 | private Double percents; 22 | private Boolean pulled; 23 | private String title; 24 | private String url; 25 | private Double value; 26 | private Boolean visibleInLegend; 27 | 28 | /** 29 | * @param alpha Opacity of a slice. 30 | * @return Slice 31 | */ 32 | public Slice setAlpha(double alpha) { 33 | this.alpha = alpha; 34 | return this; 35 | } 36 | 37 | public Double getAlpha() { 38 | return alpha; 39 | } 40 | 41 | /** 42 | * @param color Color of a slice. 43 | * @return Slice 44 | */ 45 | public Slice setColor(Color color) { 46 | this.color = color; 47 | return this; 48 | } 49 | 50 | public Color getColor() { 51 | return color; 52 | } 53 | 54 | /** 55 | * @param dataContext Original object from data provider. 56 | * @return Slice 57 | */ 58 | public Slice setDataContext(Object dataContext) { 59 | this.dataContext = dataContext; 60 | return this; 61 | } 62 | 63 | public Object getDataContext() { 64 | return dataContext; 65 | } 66 | 67 | /** 68 | * @param description Slice description. 69 | * @return Slice 70 | */ 71 | public Slice setDescription(String description) { 72 | this.description = description; 73 | return this; 74 | } 75 | 76 | public String getDescription() { 77 | return description; 78 | } 79 | 80 | /** 81 | * @param hidden Specifies whether the slice is hidden 82 | * @return Slice 83 | */ 84 | public Slice setHidden(boolean hidden) { 85 | this.hidden = hidden; 86 | return this; 87 | } 88 | 89 | public Boolean getHidden() { 90 | return hidden; 91 | } 92 | 93 | /** 94 | * @param percents Percent value of a slice. 95 | * @return Slice 96 | */ 97 | public Slice setPercents(double percents) { 98 | this.percents = percents; 99 | return this; 100 | } 101 | 102 | public Double getPercents() { 103 | return percents; 104 | } 105 | 106 | /** 107 | * @param pulled Specifies whether the slice is pulled or not. 108 | * @return Slice 109 | */ 110 | public Slice setPulled(boolean pulled) { 111 | this.pulled = pulled; 112 | return this; 113 | } 114 | 115 | public Boolean getPulled() { 116 | return pulled; 117 | } 118 | 119 | /** 120 | * @param title Slice title 121 | * @return Slice 122 | */ 123 | public Slice setTitle(String title) { 124 | this.title = title; 125 | return this; 126 | } 127 | 128 | public String getTitle() { 129 | return title; 130 | } 131 | 132 | /** 133 | * @param url Url of a slice 134 | * @return Slice 135 | */ 136 | public Slice setUrl(String url) { 137 | this.url = url; 138 | return this; 139 | } 140 | 141 | public String getUrl() { 142 | return url; 143 | } 144 | 145 | /** 146 | * @param value Value of a slice 147 | * @return Slice 148 | */ 149 | public Slice setValue(double value) { 150 | this.value = value; 151 | return this; 152 | } 153 | 154 | public Double getValue() { 155 | return value; 156 | } 157 | 158 | /** 159 | * @param visibleInLegend specifies whether this slice has a legend entry 160 | * @return Slice 161 | */ 162 | public Slice setVisibleInLegend(boolean visibleInLegend) { 163 | this.visibleInLegend = visibleInLegend; 164 | return this; 165 | } 166 | 167 | public Boolean getVisibleInLegend() { 168 | return visibleInLegend; 169 | } 170 | 171 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/GaugeBand.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | /** 9 | * Creates a band for a specified value range on the GaugeAxis. Multiple bands can be 10 | * assigned to a single GaugeAxis. 11 | */ 12 | 13 | public class GaugeBand implements Serializable { 14 | private Double alpha; 15 | private String balloonText; 16 | private Color color; 17 | private Double endValue; 18 | private List gradientRatio; 19 | private String id; 20 | private String innerRadius; 21 | private String radius; 22 | private Double startValue; 23 | private String url; 24 | 25 | /** 26 | * @param alpha Opacity of band fill. Will use axis.bandAlpha if not set any. 27 | * @return GaugeBand 28 | */ 29 | public GaugeBand setAlpha(double alpha) { 30 | this.alpha = alpha; 31 | return this; 32 | } 33 | 34 | public Double getAlpha() { 35 | return alpha; 36 | } 37 | 38 | /** 39 | * @param balloonText *When rolled-over, band will display balloon if you set some text for this property. 40 | * @return GaugeBand 41 | */ 42 | public GaugeBand setBalloonText(String balloonText) { 43 | this.balloonText = balloonText; 44 | return this; 45 | } 46 | 47 | public String getBalloonText() { 48 | return balloonText; 49 | } 50 | 51 | /** 52 | * @param color Color of a band. 53 | * @return GaugeBand 54 | */ 55 | public GaugeBand setColor(Color color) { 56 | this.color = color; 57 | return this; 58 | } 59 | 60 | public Color getColor() { 61 | return color; 62 | } 63 | 64 | /** 65 | * @param endValue End value of a fill. 66 | * @return GaugeBand 67 | */ 68 | public GaugeBand setEndValue(double endValue) { 69 | this.endValue = endValue; 70 | return this; 71 | } 72 | 73 | public Double getEndValue() { 74 | return endValue; 75 | } 76 | 77 | /** 78 | * @param gradientRatio Example: [-0.2, 0, -0.2]. Will make bands to be filled with color gradients. Negative 79 | * value means the color will be darker than the original, and positive number means 80 | * the color will be lighter. 81 | * @return GaugeBand 82 | */ 83 | public GaugeBand setGradientRatio(List gradientRatio) { 84 | this.gradientRatio = gradientRatio; 85 | return this; 86 | } 87 | 88 | public List getGradientRatio() { 89 | return gradientRatio; 90 | } 91 | 92 | /** 93 | * @param id Unique id of a band. 94 | * @return GaugeBand 95 | */ 96 | public GaugeBand setId(String id) { 97 | this.id = id; 98 | return this; 99 | } 100 | 101 | public String getId() { 102 | return id; 103 | } 104 | 105 | /** 106 | * @param innerRadius Inner radius of a band. If not set any, the band will end with the end of minor ticks. 107 | * Set 0 if you want the band to be drawn to the axis center. 108 | * @return GaugeBand 109 | */ 110 | public GaugeBand setInnerRadius(String innerRadius) { 111 | this.innerRadius = innerRadius; 112 | return this; 113 | } 114 | 115 | public String getInnerRadius() { 116 | return innerRadius; 117 | } 118 | 119 | /** 120 | * @param radius Band radius. If not set any, the band will start with the axis outline. 121 | * @return GaugeBand 122 | */ 123 | public GaugeBand setRadius(String radius) { 124 | this.radius = radius; 125 | return this; 126 | } 127 | 128 | public String getRadius() { 129 | return radius; 130 | } 131 | 132 | /** 133 | * @param startValue Start value of a fill. 134 | * @return GaugeBand 135 | */ 136 | public GaugeBand setStartValue(double startValue) { 137 | this.startValue = startValue; 138 | return this; 139 | } 140 | 141 | public Double getStartValue() { 142 | return startValue; 143 | } 144 | 145 | /** 146 | * @param url Gauge band can be clickable and can lead to some page. 147 | * @return GaugeBand 148 | */ 149 | public GaugeBand setUrl(String url) { 150 | this.url = url; 151 | return this; 152 | } 153 | 154 | public String getUrl() { 155 | return url; 156 | } 157 | 158 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmCharts.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * Namespace of the framework which holds the general settings, gets automatically injected 8 | * to document since the source has been included. 9 | */ 10 | 11 | public class AmCharts implements Serializable { 12 | private Boolean baseHref; 13 | private List charts; 14 | private List dayNames; 15 | private List monthNames; 16 | private Double processDelay; 17 | private List shortDayNames; 18 | private List shortMonthNames; 19 | private String theme; 20 | private Boolean useUTC; 21 | 22 | /** 23 | * @param baseHref Set it to true if you have base href set in your web page header. This will fix rendering 24 | * issues caused by this feature, like masks filters not working, causing graphs to 25 | * protrude from plot area. 26 | * @return AmCharts 27 | */ 28 | public AmCharts setBaseHref(boolean baseHref) { 29 | this.baseHref = baseHref; 30 | return this; 31 | } 32 | 33 | public Boolean getBaseHref() { 34 | return baseHref; 35 | } 36 | 37 | /** 38 | * @param charts This array will hold references to all instances of the charts or maps created on 39 | * the same page. 40 | * @return AmCharts 41 | */ 42 | public AmCharts setCharts(List charts) { 43 | this.charts = charts; 44 | return this; 45 | } 46 | 47 | public List getCharts() { 48 | return charts; 49 | } 50 | 51 | /** 52 | * @param dayNames Array of day names, used when formatting dates (if categoryAxis.parseDates is set 53 | * to true) 54 | * @return AmCharts 55 | */ 56 | public AmCharts setDayNames(List dayNames) { 57 | this.dayNames = dayNames; 58 | return this; 59 | } 60 | 61 | public List getDayNames() { 62 | return dayNames; 63 | } 64 | 65 | /** 66 | * @param monthNames Array of month names, used when formatting dates (if categoryAxis.parseDates is set 67 | * to true) 68 | * @return AmCharts 69 | */ 70 | public AmCharts setMonthNames(List monthNames) { 71 | this.monthNames = monthNames; 72 | return this; 73 | } 74 | 75 | public List getMonthNames() { 76 | return monthNames; 77 | } 78 | 79 | /** 80 | * @param processDelay Delay in ms at which each chart on the page should be rendered. This is very handy 81 | * if you have a lot of charts on the page and do not want to overload the device CPU. 82 | * @return AmCharts 83 | */ 84 | public AmCharts setProcessDelay(double processDelay) { 85 | this.processDelay = processDelay; 86 | return this; 87 | } 88 | 89 | public Double getProcessDelay() { 90 | return processDelay; 91 | } 92 | 93 | /** 94 | * @param shortDayNames Array of short versions of day names, used when formatting dates (if categoryAxis.parseDates 95 | * is set to true) 96 | * @return AmCharts 97 | */ 98 | public AmCharts setShortDayNames(List shortDayNames) { 99 | this.shortDayNames = shortDayNames; 100 | return this; 101 | } 102 | 103 | public List getShortDayNames() { 104 | return shortDayNames; 105 | } 106 | 107 | /** 108 | * @param shortMonthNames Array of short versions of month names, used when formatting dates (if categoryAxis.parseDates 109 | * is set to true) 110 | * @return AmCharts 111 | */ 112 | public AmCharts setShortMonthNames(List shortMonthNames) { 113 | this.shortMonthNames = shortMonthNames; 114 | return this; 115 | } 116 | 117 | public List getShortMonthNames() { 118 | return shortMonthNames; 119 | } 120 | 121 | /** 122 | * @param theme You can set theme for all the charts on your page by setting: AmCharts.theme = AmCharts.themes.light; 123 | * // or some other theme. If you are creating charts using JavaScript API, not JSON, 124 | * then this is quite a comfortable way, as you won't need to pass theme to each object 125 | * you create. Note, you should set theme before write method is called. There is no 126 | * way to change theme of already created chart, you have to create chart's instance 127 | * once more if you want to change theme. 128 | * @return AmCharts 129 | */ 130 | public AmCharts setTheme(String theme) { 131 | this.theme = theme; 132 | return this; 133 | } 134 | 135 | public String getTheme() { 136 | return theme; 137 | } 138 | 139 | /** 140 | * @param useUTC Set it to true if you want UTC time to be used instead of local time. 141 | * @return AmCharts 142 | */ 143 | public AmCharts setUseUTC(boolean useUTC) { 144 | this.useUTC = useUTC; 145 | return this; 146 | } 147 | 148 | public Boolean getUseUTC() { 149 | return useUTC; 150 | } 151 | 152 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/GaugeArrow.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Creates an arrow for AmAngularGauge charts, multiple can be assigned. 9 | */ 10 | 11 | public class GaugeArrow implements Serializable { 12 | private Double alpha; 13 | private GaugeAxis axis; 14 | private Double borderAlpha; 15 | private Boolean clockWiseOnly; 16 | private Color color; 17 | private String id; 18 | private String innerRadius; 19 | private Double nailAlpha; 20 | private Double nailBorderAlpha; 21 | private Double nailBorderThickness; 22 | private Double nailRadius; 23 | private String radius; 24 | private Double startWidth; 25 | private Double value; 26 | 27 | /** 28 | * @param alpha Opacity of an arrow. 29 | * @return GaugeArrow 30 | */ 31 | public GaugeArrow setAlpha(double alpha) { 32 | this.alpha = alpha; 33 | return this; 34 | } 35 | 36 | public Double getAlpha() { 37 | return alpha; 38 | } 39 | 40 | /** 41 | * @param axis Axis of the arrow. You can use reference to the axis or id of the axis. If you don't 42 | * set any axis, the first axis of a chart will be used. 43 | * @return GaugeArrow 44 | */ 45 | public GaugeArrow setAxis(GaugeAxis axis) { 46 | this.axis = axis; 47 | return this; 48 | } 49 | 50 | public GaugeAxis getAxis() { 51 | return axis; 52 | } 53 | 54 | /** 55 | * @param borderAlpha Opacity of arrow border. 56 | * @return GaugeArrow 57 | */ 58 | public GaugeArrow setBorderAlpha(double borderAlpha) { 59 | this.borderAlpha = borderAlpha; 60 | return this; 61 | } 62 | 63 | public Double getBorderAlpha() { 64 | return borderAlpha; 65 | } 66 | 67 | /** 68 | * @param clockWiseOnly In case you need the arrow to rotate only clock-wise, set this property to true. 69 | * @return GaugeArrow 70 | */ 71 | public GaugeArrow setClockWiseOnly(boolean clockWiseOnly) { 72 | this.clockWiseOnly = clockWiseOnly; 73 | return this; 74 | } 75 | 76 | public Boolean getClockWiseOnly() { 77 | return clockWiseOnly; 78 | } 79 | 80 | /** 81 | * @param color Color of an arrow. 82 | * @return GaugeArrow 83 | */ 84 | public GaugeArrow setColor(Color color) { 85 | this.color = color; 86 | return this; 87 | } 88 | 89 | public Color getColor() { 90 | return color; 91 | } 92 | 93 | /** 94 | * @param id Unique id of an arrow. 95 | * @return GaugeArrow 96 | */ 97 | public GaugeArrow setId(String id) { 98 | this.id = id; 99 | return this; 100 | } 101 | 102 | public String getId() { 103 | return id; 104 | } 105 | 106 | /** 107 | * @param innerRadius Inner radius of an arrow. 108 | * @return GaugeArrow 109 | */ 110 | public GaugeArrow setInnerRadius(String innerRadius) { 111 | this.innerRadius = innerRadius; 112 | return this; 113 | } 114 | 115 | public String getInnerRadius() { 116 | return innerRadius; 117 | } 118 | 119 | /** 120 | * @param nailAlpha Opacity of a nail, holding the arrow. 121 | * @return GaugeArrow 122 | */ 123 | public GaugeArrow setNailAlpha(double nailAlpha) { 124 | this.nailAlpha = nailAlpha; 125 | return this; 126 | } 127 | 128 | public Double getNailAlpha() { 129 | return nailAlpha; 130 | } 131 | 132 | /** 133 | * @param nailBorderAlpha Opacity of nail border. 134 | * @return GaugeArrow 135 | */ 136 | public GaugeArrow setNailBorderAlpha(double nailBorderAlpha) { 137 | this.nailBorderAlpha = nailBorderAlpha; 138 | return this; 139 | } 140 | 141 | public Double getNailBorderAlpha() { 142 | return nailBorderAlpha; 143 | } 144 | 145 | /** 146 | * @param nailBorderThickness Thickness of nail border. 147 | * @return GaugeArrow 148 | */ 149 | public GaugeArrow setNailBorderThickness(double nailBorderThickness) { 150 | this.nailBorderThickness = nailBorderThickness; 151 | return this; 152 | } 153 | 154 | public Double getNailBorderThickness() { 155 | return nailBorderThickness; 156 | } 157 | 158 | /** 159 | * @param nailRadius Radius of a nail, holding the arrow. 160 | * @return GaugeArrow 161 | */ 162 | public GaugeArrow setNailRadius(double nailRadius) { 163 | this.nailRadius = nailRadius; 164 | return this; 165 | } 166 | 167 | public Double getNailRadius() { 168 | return nailRadius; 169 | } 170 | 171 | /** 172 | * @param radius Radius of an arrow. 173 | * @return GaugeArrow 174 | */ 175 | public GaugeArrow setRadius(String radius) { 176 | this.radius = radius; 177 | return this; 178 | } 179 | 180 | public String getRadius() { 181 | return radius; 182 | } 183 | 184 | /** 185 | * @param startWidth Width of arrow root. 186 | * @return GaugeArrow 187 | */ 188 | public GaugeArrow setStartWidth(double startWidth) { 189 | this.startWidth = startWidth; 190 | return this; 191 | } 192 | 193 | public Double getStartWidth() { 194 | return startWidth; 195 | } 196 | 197 | /** 198 | * @param value Value to which the arrow should point at. 199 | * @return GaugeArrow 200 | */ 201 | public GaugeArrow setValue(double value) { 202 | this.value = value; 203 | return this; 204 | } 205 | 206 | public Double getValue() { 207 | return value; 208 | } 209 | 210 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmCoordinateChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * *Base class of AmRectangularChart and AmRadarChart. It can not be instantiated explicitly. 9 | */ 10 | 11 | public class AmCoordinateChart extends AmChart { 12 | private List chartData; 13 | private List colors; 14 | private List graphs; 15 | private Boolean gridAboveGraphs; 16 | private List guides; 17 | private Boolean sequencedAnimation; 18 | private Double startAlpha; 19 | private Double startDuration; 20 | private String startEffect; 21 | private String urlTarget; 22 | private List valueAxes; 23 | 24 | /** 25 | * @param chartData Read-only. Array, holding processed chart's data. 26 | * @return AmCoordinateChart 27 | */ 28 | public AmCoordinateChart setChartData(List chartData) { 29 | this.chartData = chartData; 30 | return this; 31 | } 32 | 33 | public List getChartData() { 34 | return chartData; 35 | } 36 | 37 | /** 38 | * @param colors Specifies the colors of the graphs if the lineColor of a graph is not set. If there 39 | * are more graphs then colors in this array, the chart picks a random color. 40 | * @return AmCoordinateChart 41 | */ 42 | public AmCoordinateChart setColors(List colors) { 43 | this.colors = colors; 44 | return this; 45 | } 46 | 47 | public List getColors() { 48 | return colors; 49 | } 50 | 51 | /** 52 | * @param graphs The array of graphs belonging to this chart. 53 | * @return AmCoordinateChart 54 | */ 55 | public AmCoordinateChart setGraphs(List graphs) { 56 | this.graphs = graphs; 57 | return this; 58 | } 59 | 60 | public List getGraphs() { 61 | return graphs; 62 | } 63 | 64 | /** 65 | * @param gridAboveGraphs Specifies if grid should be drawn above the graphs or below. Will not work properly 66 | * with 3D charts. 67 | * @return AmCoordinateChart 68 | */ 69 | public AmCoordinateChart setGridAboveGraphs(boolean gridAboveGraphs) { 70 | this.gridAboveGraphs = gridAboveGraphs; 71 | return this; 72 | } 73 | 74 | public Boolean getGridAboveGraphs() { 75 | return gridAboveGraphs; 76 | } 77 | 78 | /** 79 | * @param guides Instead of adding guides to the axes, you can push all of them to this array. In 80 | * case guide has category or date defined, it will automatically will be assigned to 81 | * the category axis. Otherwise to first value axis, unless you specify a different 82 | * valueAxis for the guide. 83 | * @return AmCoordinateChart 84 | */ 85 | public AmCoordinateChart setGuides(List guides) { 86 | this.guides = guides; 87 | return this; 88 | } 89 | 90 | public List getGuides() { 91 | return guides; 92 | } 93 | 94 | /** 95 | * @param sequencedAnimation Specifies whether the animation should be sequenced or all objects should appear 96 | * at once. 97 | * @return AmCoordinateChart 98 | */ 99 | public AmCoordinateChart setSequencedAnimation(boolean sequencedAnimation) { 100 | this.sequencedAnimation = sequencedAnimation; 101 | return this; 102 | } 103 | 104 | public Boolean getSequencedAnimation() { 105 | return sequencedAnimation; 106 | } 107 | 108 | /** 109 | * @param startAlpha The initial opacity of the column/line. If you set startDuration to a value higher 110 | * than 0, the columns/lines will fade in from startAlpha. Value range is 0 - 1. 111 | * @return AmCoordinateChart 112 | */ 113 | public AmCoordinateChart setStartAlpha(double startAlpha) { 114 | this.startAlpha = startAlpha; 115 | return this; 116 | } 117 | 118 | public Double getStartAlpha() { 119 | return startAlpha; 120 | } 121 | 122 | /** 123 | * @param startDuration Duration of the animation, in seconds. 124 | * @return AmCoordinateChart 125 | */ 126 | public AmCoordinateChart setStartDuration(double startDuration) { 127 | this.startDuration = startDuration; 128 | return this; 129 | } 130 | 131 | public Double getStartDuration() { 132 | return startDuration; 133 | } 134 | 135 | /** 136 | * @param startEffect Animation effect. Possible values are: easeOutSine, easeInSine, elastic, bounce 137 | * @return AmCoordinateChart 138 | */ 139 | public AmCoordinateChart setStartEffect(String startEffect) { 140 | this.startEffect = startEffect; 141 | return this; 142 | } 143 | 144 | public String getStartEffect() { 145 | return startEffect; 146 | } 147 | 148 | /** 149 | * @param urlTarget Target of url. 150 | * @return AmCoordinateChart 151 | */ 152 | public AmCoordinateChart setUrlTarget(String urlTarget) { 153 | this.urlTarget = urlTarget; 154 | return this; 155 | } 156 | 157 | public String getUrlTarget() { 158 | return urlTarget; 159 | } 160 | 161 | /** 162 | * @param valueAxes The array of value axes. Chart creates one value axis automatically, so if you need 163 | * only one value axis, you don't need to create it. 164 | * @return AmCoordinateChart 165 | */ 166 | public AmCoordinateChart setValueAxes(List valueAxes) { 167 | this.valueAxes = valueAxes; 168 | return this; 169 | } 170 | 171 | public List getValueAxes() { 172 | return valueAxes; 173 | } 174 | 175 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/GraphDataItem.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | /** 9 | * GraphDataItem holds all the information about the graph's data item. When working 10 | * with a chart, you do not create GraphDataItem objects or change it's properties directly. 11 | * GraphDataItem is passed to you by events when user interacts with data item on the 12 | * chart. The list of properties below will help you to extract data item's value/coordinate/etc. 13 | */ 14 | 15 | public class GraphDataItem implements Serializable { 16 | private Double alpha; 17 | private String bullet; 18 | private Double bulletSize; 19 | private String category; 20 | private Color color; 21 | private String customBullet; 22 | private Object dataContext; 23 | private String description; 24 | private List fillColors; 25 | private Object percents; 26 | private SerialDataItem serialDataItem; 27 | private String url; 28 | private Object values; 29 | private Double x; 30 | private Double y; 31 | 32 | /** 33 | * @param alpha Opacity of the data item. 34 | * @return GraphDataItem 35 | */ 36 | public GraphDataItem setAlpha(double alpha) { 37 | this.alpha = alpha; 38 | return this; 39 | } 40 | 41 | public Double getAlpha() { 42 | return alpha; 43 | } 44 | 45 | /** 46 | * @param bullet Bullet type. 47 | * @return GraphDataItem 48 | */ 49 | public GraphDataItem setBullet(String bullet) { 50 | this.bullet = bullet; 51 | return this; 52 | } 53 | 54 | public String getBullet() { 55 | return bullet; 56 | } 57 | 58 | /** 59 | * @param bulletSize Bullet size. 60 | * @return GraphDataItem 61 | */ 62 | public GraphDataItem setBulletSize(double bulletSize) { 63 | this.bulletSize = bulletSize; 64 | return this; 65 | } 66 | 67 | public Double getBulletSize() { 68 | return bulletSize; 69 | } 70 | 71 | /** 72 | * @param category Category value. 73 | * @return GraphDataItem 74 | */ 75 | public GraphDataItem setCategory(String category) { 76 | this.category = category; 77 | return this; 78 | } 79 | 80 | public String getCategory() { 81 | return category; 82 | } 83 | 84 | /** 85 | * @param color Color of the data item. 86 | * @return GraphDataItem 87 | */ 88 | public GraphDataItem setColor(Color color) { 89 | this.color = color; 90 | return this; 91 | } 92 | 93 | public Color getColor() { 94 | return color; 95 | } 96 | 97 | /** 98 | * @param customBullet Custom bullet (path to file name). 99 | * @return GraphDataItem 100 | */ 101 | public GraphDataItem setCustomBullet(String customBullet) { 102 | this.customBullet = customBullet; 103 | return this; 104 | } 105 | 106 | public String getCustomBullet() { 107 | return customBullet; 108 | } 109 | 110 | /** 111 | * @param dataContext Original object from data provider. 112 | * @return GraphDataItem 113 | */ 114 | public GraphDataItem setDataContext(Object dataContext) { 115 | this.dataContext = dataContext; 116 | return this; 117 | } 118 | 119 | public Object getDataContext() { 120 | return dataContext; 121 | } 122 | 123 | /** 124 | * @param description Description. 125 | * @return GraphDataItem 126 | */ 127 | public GraphDataItem setDescription(String description) { 128 | this.description = description; 129 | return this; 130 | } 131 | 132 | public String getDescription() { 133 | return description; 134 | } 135 | 136 | /** 137 | * @param fillColors Array of colors of the data item, used by column and candlestick chart only. 138 | * @return GraphDataItem 139 | */ 140 | public GraphDataItem setFillColors(List fillColors) { 141 | this.fillColors = fillColors; 142 | return this; 143 | } 144 | 145 | public List getFillColors() { 146 | return fillColors; 147 | } 148 | 149 | /** 150 | * @param percents Object which holds percents when recalculateToPercents is set to true. 151 | * @return GraphDataItem 152 | */ 153 | public GraphDataItem setPercents(Object percents) { 154 | this.percents = percents; 155 | return this; 156 | } 157 | 158 | public Object getPercents() { 159 | return percents; 160 | } 161 | 162 | /** 163 | * @param serialDataItem SerialDataItem of this graphDataItem 164 | * @return GraphDataItem 165 | */ 166 | public GraphDataItem setSerialDataItem(SerialDataItem serialDataItem) { 167 | this.serialDataItem = serialDataItem; 168 | return this; 169 | } 170 | 171 | public SerialDataItem getSerialDataItem() { 172 | return serialDataItem; 173 | } 174 | 175 | /** 176 | * @param url url 177 | * @return GraphDataItem 178 | */ 179 | public GraphDataItem setUrl(String url) { 180 | this.url = url; 181 | return this; 182 | } 183 | 184 | public String getUrl() { 185 | return url; 186 | } 187 | 188 | /** 189 | * @param values Object which holds values of the data item (value, open, close, low, high). 190 | * @return GraphDataItem 191 | */ 192 | public GraphDataItem setValues(Object values) { 193 | this.values = values; 194 | return this; 195 | } 196 | 197 | public Object getValues() { 198 | return values; 199 | } 200 | 201 | /** 202 | * @param x x coordinate of the data item. 203 | * @return GraphDataItem 204 | */ 205 | public GraphDataItem setX(double x) { 206 | this.x = x; 207 | return this; 208 | } 209 | 210 | public Double getX() { 211 | return x; 212 | } 213 | 214 | /** 215 | * @param y y coordinate of the data item. 216 | * @return GraphDataItem 217 | */ 218 | public GraphDataItem setY(double y) { 219 | this.y = y; 220 | return this; 221 | } 222 | 223 | public Double getY() { 224 | return y; 225 | } 226 | 227 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmFunnelChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | /** 4 | * Extension for AmSlicedChart to create funnel/pyramid charts. 5 | */ 6 | 7 | public class AmFunnelChart extends AmSlicedChart { 8 | private Double angle; 9 | private String balloonText; 10 | private String baseWidth; 11 | private Double depth3D; 12 | private String labelPosition; 13 | private String labelText; 14 | private String neckHeight; 15 | private String neckWidth; 16 | private String pullDistance; 17 | private Boolean rotate; 18 | private Double startX; 19 | private Double startY; 20 | private String valueRepresents; 21 | 22 | /** 23 | * @param angle The angle of the 3D part of the chart. This creates a 3D effect (if the "depth3D" 24 | * is > 0). 25 | * @return AmFunnelChart 26 | */ 27 | public AmFunnelChart setAngle(double angle) { 28 | this.angle = angle; 29 | return this; 30 | } 31 | 32 | public Double getAngle() { 33 | return angle; 34 | } 35 | 36 | /** 37 | * @param balloonText Balloon text. The following tags can be used: [[value]], [[title]], [[percents]], 38 | * [[description]] or any other field name from your data provider. HTML tags can also 39 | * be used. 40 | * @return AmFunnelChart 41 | */ 42 | public AmFunnelChart setBalloonText(String balloonText) { 43 | this.balloonText = balloonText; 44 | return this; 45 | } 46 | 47 | public String getBalloonText() { 48 | return balloonText; 49 | } 50 | 51 | /** 52 | * @param baseWidth Width of a base (first slice) of a chart. "100%" means it will occupy all available 53 | * space. 54 | * @return AmFunnelChart 55 | */ 56 | public AmFunnelChart setBaseWidth(String baseWidth) { 57 | this.baseWidth = baseWidth; 58 | return this; 59 | } 60 | 61 | public String getBaseWidth() { 62 | return baseWidth; 63 | } 64 | 65 | /** 66 | * @param depth3D The depth of funnel/pyramid. Set angle to >0 value in order this to work. Note, neckHeight/neckWidth 67 | * will become 0 if you set these properties to bigger than 0 values. 68 | * @return AmFunnelChart 69 | */ 70 | public AmFunnelChart setDepth3D(double depth3D) { 71 | this.depth3D = depth3D; 72 | return this; 73 | } 74 | 75 | public Double getDepth3D() { 76 | return depth3D; 77 | } 78 | 79 | /** 80 | * @param labelPosition Specifies where labels should be placed. Allowed values are left / center / right. 81 | * If you set left or right, you should increase left or right margin in order labels 82 | * to be visible. 83 | * @return AmFunnelChart 84 | */ 85 | public AmFunnelChart setLabelPosition(String labelPosition) { 86 | this.labelPosition = labelPosition; 87 | return this; 88 | } 89 | 90 | public String getLabelPosition() { 91 | return labelPosition; 92 | } 93 | 94 | /** 95 | * @param labelText Label text. The following tags can be used: [[value]], [[title]], [[percents]], [[description]] 96 | * or any other field name from your data provider. 97 | * @return AmFunnelChart 98 | */ 99 | public AmFunnelChart setLabelText(String labelText) { 100 | this.labelText = labelText; 101 | return this; 102 | } 103 | 104 | public String getLabelText() { 105 | return labelText; 106 | } 107 | 108 | /** 109 | * @param neckHeight Height of a funnel neck. If default value, zero is used, the funnel won't have neck 110 | * at all, which will make it look like pyramid. 111 | * @return AmFunnelChart 112 | */ 113 | public AmFunnelChart setNeckHeight(String neckHeight) { 114 | this.neckHeight = neckHeight; 115 | return this; 116 | } 117 | 118 | public String getNeckHeight() { 119 | return neckHeight; 120 | } 121 | 122 | /** 123 | * @param neckWidth Width of a funnel neck. If default value, zero is used, the funnel won't have neck 124 | * at all, which will make it look like pyramid. 125 | * @return AmFunnelChart 126 | */ 127 | public AmFunnelChart setNeckWidth(String neckWidth) { 128 | this.neckWidth = neckWidth; 129 | return this; 130 | } 131 | 132 | public String getNeckWidth() { 133 | return neckWidth; 134 | } 135 | 136 | /** 137 | * @param pullDistance Specifies the distance by which slice should be pulled when user clicks on it. 138 | * @return AmFunnelChart 139 | */ 140 | public AmFunnelChart setPullDistance(String pullDistance) { 141 | this.pullDistance = pullDistance; 142 | return this; 143 | } 144 | 145 | public String getPullDistance() { 146 | return pullDistance; 147 | } 148 | 149 | /** 150 | * @param rotate If rotate is set to true, the funnel will be rotated and will became a pyramid. 151 | * @return AmFunnelChart 152 | */ 153 | public AmFunnelChart setRotate(boolean rotate) { 154 | this.rotate = rotate; 155 | return this; 156 | } 157 | 158 | public Boolean getRotate() { 159 | return rotate; 160 | } 161 | 162 | /** 163 | * @param startX Initial x coordinate of slices. They will animate to the final x position from this 164 | * one. 165 | * @return AmFunnelChart 166 | */ 167 | public AmFunnelChart setStartX(double startX) { 168 | this.startX = startX; 169 | return this; 170 | } 171 | 172 | public Double getStartX() { 173 | return startX; 174 | } 175 | 176 | /** 177 | * @param startY Initial y coordinate of slices. They will animate to the final y position from this 178 | * one. 179 | * @return AmFunnelChart 180 | */ 181 | public AmFunnelChart setStartY(double startY) { 182 | this.startY = startY; 183 | return this; 184 | } 185 | 186 | public Double getStartY() { 187 | return startY; 188 | } 189 | 190 | /** 191 | * @param valueRepresents By default, the height of a slice represents it's value. However you might want the 192 | * area of a slice to represent value - set this property to "area" then. 193 | * @return AmFunnelChart 194 | */ 195 | public AmFunnelChart setValueRepresents(String valueRepresents) { 196 | this.valueRepresents = valueRepresents; 197 | return this; 198 | } 199 | 200 | public String getValueRepresents() { 201 | return valueRepresents; 202 | } 203 | 204 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmGanttChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Extension for AmSerialChart to gantt charts. Gantt charts usually display multiple 7 | * bars on one series where value axis displays date/time and is horizontal. 8 | */ 9 | 10 | public class AmGanttChart extends AmSerialChart { 11 | private Double brightnessStep; 12 | private String columnWidthField; 13 | private String durationField; 14 | private String endDateField; 15 | private String endField; 16 | private AmGraph graph; 17 | private String period; 18 | private String segmentsField; 19 | private Date startDate; 20 | private String startDateField; 21 | private String startField; 22 | private ValueAxis valueAxis; 23 | 24 | /** 25 | * @param brightnessStep Lightness increase of each subsequent bar of one series. Value range is from -255 26 | * to 255. 27 | * @return AmGanttChart 28 | */ 29 | public AmGanttChart setBrightnessStep(double brightnessStep) { 30 | this.brightnessStep = brightnessStep; 31 | return this; 32 | } 33 | 34 | public Double getBrightnessStep() { 35 | return brightnessStep; 36 | } 37 | 38 | /** 39 | * @param columnWidthField Field of column width of a segments in your data provider. 40 | * @return AmGanttChart 41 | */ 42 | public AmGanttChart setColumnWidthField(String columnWidthField) { 43 | this.columnWidthField = columnWidthField; 44 | return this; 45 | } 46 | 47 | public String getColumnWidthField() { 48 | return columnWidthField; 49 | } 50 | 51 | /** 52 | * @param durationField Instead of specifying end date or end value in your data, you can specify duration 53 | * of a segment. 54 | * @return AmGanttChart 55 | */ 56 | public AmGanttChart setDurationField(String durationField) { 57 | this.durationField = durationField; 58 | return this; 59 | } 60 | 61 | public String getDurationField() { 62 | return durationField; 63 | } 64 | 65 | /** 66 | * @param endDateField Field in your data provider which holds end date of a segment. Dates in your data 67 | * can be set by time stamp or Date object or string (chart.dataDateFormat should define 68 | * date format in latter case). 69 | * @return AmGanttChart 70 | */ 71 | public AmGanttChart setEndDateField(String endDateField) { 72 | this.endDateField = endDateField; 73 | return this; 74 | } 75 | 76 | public String getEndDateField() { 77 | return endDateField; 78 | } 79 | 80 | /** 81 | * @param endField Field in your data provider which holds end value of a segment. If your data is date-based, 82 | * you should use endDateField instead, unless you specified chart.startDate and chart.period 83 | * values. In this case you can use endField and set number of periods instead of providing 84 | * exact end date. 85 | * @return AmGanttChart 86 | */ 87 | public AmGanttChart setEndField(String endField) { 88 | this.endField = endField; 89 | return this; 90 | } 91 | 92 | public String getEndField() { 93 | return endField; 94 | } 95 | 96 | /** 97 | * @param graph Graph of a Gantt chart. Gant chart actually creates multiple graphs (separate for 98 | * each segment). Properties of this graph are passed to each of the created graphs 99 | * - this allows you to control the look of segments. 100 | * @return AmGanttChart 101 | */ 102 | public AmGanttChart setGraph(AmGraph graph) { 103 | this.graph = graph; 104 | return this; 105 | } 106 | 107 | public AmGraph getGraph() { 108 | return graph; 109 | } 110 | 111 | /** 112 | * @param period Data period. Used only value axis is date-based. 113 | * @return AmGanttChart 114 | */ 115 | public AmGanttChart setPeriod(String period) { 116 | this.period = period; 117 | return this; 118 | } 119 | 120 | public String getPeriod() { 121 | return period; 122 | } 123 | 124 | /** 125 | * @param segmentsField Segments field in your data provider. 126 | * @return AmGanttChart 127 | */ 128 | public AmGanttChart setSegmentsField(String segmentsField) { 129 | this.segmentsField = segmentsField; 130 | return this; 131 | } 132 | 133 | public String getSegmentsField() { 134 | return segmentsField; 135 | } 136 | 137 | /** 138 | * @param startDate Initial date of value axis. If you set this date (you can do it using time stamp, 139 | * Date object or date string), you can then set start/end/duration of segments using 140 | * number of periods instead of providing exact dates. 141 | * @return AmGanttChart 142 | */ 143 | public AmGanttChart setStartDate(Date startDate) { 144 | this.startDate = startDate; 145 | return this; 146 | } 147 | 148 | public Date getStartDate() { 149 | return startDate; 150 | } 151 | 152 | /** 153 | * @param startDateField Field in your data provider which holds start date of a segment. Dates in your data 154 | * can be set by time stamp or Date object or string (chart.dataDateFormat should define 155 | * date format in latter case). 156 | * @return AmGanttChart 157 | */ 158 | public AmGanttChart setStartDateField(String startDateField) { 159 | this.startDateField = startDateField; 160 | return this; 161 | } 162 | 163 | public String getStartDateField() { 164 | return startDateField; 165 | } 166 | 167 | /** 168 | * @param startField Field in your data provider which holds start value of a segment. If your data is 169 | * date-based, you should use startDateField instead, unless you specified chart.startDate 170 | * and chart.period values. In this case you can use startField and set number of periods 171 | * instead of providing exact start date. 172 | * @return AmGanttChart 173 | */ 174 | public AmGanttChart setStartField(String startField) { 175 | this.startField = startField; 176 | return this; 177 | } 178 | 179 | public String getStartField() { 180 | return startField; 181 | } 182 | 183 | /** 184 | * @param valueAxis *Value axis of Gantt chart. Set it's type to "date" if your data is date or time based. 185 | * @return AmGanttChart 186 | */ 187 | public AmGanttChart setValueAxis(ValueAxis valueAxis) { 188 | this.valueAxis = valueAxis; 189 | return this; 190 | } 191 | 192 | public ValueAxis getValueAxis() { 193 | return valueAxis; 194 | } 195 | 196 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmPieChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | /** 4 | * Extension for AmSlicedChart to create pie/donut charts. 5 | */ 6 | 7 | public class AmPieChart extends AmSlicedChart { 8 | private Boolean adjustPrecision; 9 | private Double angle; 10 | private String balloonText; 11 | private Double depth3D; 12 | private String gradientType; 13 | private String innerRadius; 14 | private Double labelRadius; 15 | private String labelRadiusField; 16 | private String labelText; 17 | private Double minRadius; 18 | private String pieX; 19 | private String pieY; 20 | private String pullOutRadius; 21 | private String radius; 22 | private Double startAngle; 23 | private String startRadius; 24 | 25 | /** 26 | * @param adjustPrecision Sometimes, because of a rounding, percent of a sum of all slices is not equal to 27 | * 100%. If you set this to true, when this case happens, number of decimals will be 28 | * increased so that sum would become 100%. 29 | * @return AmPieChart 30 | */ 31 | public AmPieChart setAdjustPrecision(boolean adjustPrecision) { 32 | this.adjustPrecision = adjustPrecision; 33 | return this; 34 | } 35 | 36 | public Boolean getAdjustPrecision() { 37 | return adjustPrecision; 38 | } 39 | 40 | /** 41 | * @param angle Pie lean angle (for 3D effect). Valid range is 0 - 90. 42 | * @return AmPieChart 43 | */ 44 | public AmPieChart setAngle(double angle) { 45 | this.angle = angle; 46 | return this; 47 | } 48 | 49 | public Double getAngle() { 50 | return angle; 51 | } 52 | 53 | /** 54 | * @param balloonText Balloon text. The following tags can be used: [[value]], [[title]], [[percents]], 55 | * [[description]] or any other field name from your data provider. HTML tags can also 56 | * be used. 57 | * @return AmPieChart 58 | */ 59 | public AmPieChart setBalloonText(String balloonText) { 60 | this.balloonText = balloonText; 61 | return this; 62 | } 63 | 64 | public String getBalloonText() { 65 | return balloonText; 66 | } 67 | 68 | /** 69 | * @param depth3D Depth of the pie (for 3D effect). 70 | * @return AmPieChart 71 | */ 72 | public AmPieChart setDepth3D(double depth3D) { 73 | this.depth3D = depth3D; 74 | return this; 75 | } 76 | 77 | public Double getDepth3D() { 78 | return depth3D; 79 | } 80 | 81 | /** 82 | * @param gradientType Type of gradient. Use gradientRatio to create gradients. 83 | * @return AmPieChart 84 | */ 85 | public AmPieChart setGradientType(String gradientType) { 86 | this.gradientType = gradientType; 87 | return this; 88 | } 89 | 90 | public String getGradientType() { 91 | return gradientType; 92 | } 93 | 94 | /** 95 | * @param innerRadius Inner radius of the pie, in pixels or percents. 96 | * @return AmPieChart 97 | */ 98 | public AmPieChart setInnerRadius(String innerRadius) { 99 | this.innerRadius = innerRadius; 100 | return this; 101 | } 102 | 103 | public String getInnerRadius() { 104 | return innerRadius; 105 | } 106 | 107 | /** 108 | * @param labelRadius The distance between the label and the slice, in pixels. You can use negative values 109 | * to put the label on the slice. 110 | * @return AmPieChart 111 | */ 112 | public AmPieChart setLabelRadius(double labelRadius) { 113 | this.labelRadius = labelRadius; 114 | return this; 115 | } 116 | 117 | public Double getLabelRadius() { 118 | return labelRadius; 119 | } 120 | 121 | /** 122 | * @param labelRadiusField Name of the field in dataProvider which specifies the length of a tick. Note, the 123 | * chart will not try to arrange labels automatically if this property is set. 124 | * @return AmPieChart 125 | */ 126 | public AmPieChart setLabelRadiusField(String labelRadiusField) { 127 | this.labelRadiusField = labelRadiusField; 128 | return this; 129 | } 130 | 131 | public String getLabelRadiusField() { 132 | return labelRadiusField; 133 | } 134 | 135 | /** 136 | * @param labelText Label text. The following tags can be used: [[value]], [[title]], [[percents]], [[description]] 137 | * or any other field name from your data provider. 138 | * @return AmPieChart 139 | */ 140 | public AmPieChart setLabelText(String labelText) { 141 | this.labelText = labelText; 142 | return this; 143 | } 144 | 145 | public String getLabelText() { 146 | return labelText; 147 | } 148 | 149 | /** 150 | * @param minRadius Minimum radius of the pie, in pixels. 151 | * @return AmPieChart 152 | */ 153 | public AmPieChart setMinRadius(double minRadius) { 154 | this.minRadius = minRadius; 155 | return this; 156 | } 157 | 158 | public Double getMinRadius() { 159 | return minRadius; 160 | } 161 | 162 | /** 163 | * @param pieX You can set fixed position of a pie center, in pixels or in percents. 164 | * @return AmPieChart 165 | */ 166 | public AmPieChart setPieX(String pieX) { 167 | this.pieX = pieX; 168 | return this; 169 | } 170 | 171 | public String getPieX() { 172 | return pieX; 173 | } 174 | 175 | /** 176 | * @param pieY You can set fixed position of a pie center, in pixels or in percents. 177 | * @return AmPieChart 178 | */ 179 | public AmPieChart setPieY(String pieY) { 180 | this.pieY = pieY; 181 | return this; 182 | } 183 | 184 | public String getPieY() { 185 | return pieY; 186 | } 187 | 188 | /** 189 | * @param pullOutRadius Pull out radius, in pixels or percents 190 | * @return AmPieChart 191 | */ 192 | public AmPieChart setPullOutRadius(String pullOutRadius) { 193 | this.pullOutRadius = pullOutRadius; 194 | return this; 195 | } 196 | 197 | public String getPullOutRadius() { 198 | return pullOutRadius; 199 | } 200 | 201 | /** 202 | * @param radius *Radius of a pie, in pixels or percents. By default, radius is calculated automatically. 203 | * @return AmPieChart 204 | */ 205 | public AmPieChart setRadius(String radius) { 206 | this.radius = radius; 207 | return this; 208 | } 209 | 210 | public String getRadius() { 211 | return radius; 212 | } 213 | 214 | /** 215 | * @param startAngle Angle of the first slice, in degrees. This will work properly only if "depth3D" is 216 | * set to 0. If "depth3D" is greater than 0, then there can be two angles only: 90 and 217 | * 270. Value range is 0-360. 218 | * @return AmPieChart 219 | */ 220 | public AmPieChart setStartAngle(double startAngle) { 221 | this.startAngle = startAngle; 222 | return this; 223 | } 224 | 225 | public Double getStartAngle() { 226 | return startAngle; 227 | } 228 | 229 | /** 230 | * @param startRadius Radius of the positions from which the slices will fly in. 231 | * @return AmPieChart 232 | */ 233 | public AmPieChart setStartRadius(String startRadius) { 234 | this.startRadius = startRadius; 235 | return this; 236 | } 237 | 238 | public String getStartRadius() { 239 | return startRadius; 240 | } 241 | 242 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmAngularGauge.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Extension for AmChart to create gauge charts. 9 | */ 10 | 11 | public class AmAngularGauge extends AmChart { 12 | private Boolean adjustSize; 13 | private List arrows; 14 | private List axes; 15 | private Boolean clockWiseOnly; 16 | private Double faceAlpha; 17 | private Double faceBorderAlpha; 18 | private Color faceBorderColor; 19 | private Double faceBorderWidth; 20 | private Color faceColor; 21 | private Object facePattern; 22 | private Double gaugeX; 23 | private Double gaugeY; 24 | private Double marginBottom; 25 | private Double marginLeft; 26 | private Double marginRight; 27 | private Double marginTop; 28 | private Double minRadius; 29 | private Double startDuration; 30 | private String startEffect; 31 | 32 | /** 33 | * @param adjustSize Uses the whole space of the canvas to draw the gauge. 34 | * @return AmAngularGauge 35 | */ 36 | public AmAngularGauge setAdjustSize(boolean adjustSize) { 37 | this.adjustSize = adjustSize; 38 | return this; 39 | } 40 | 41 | public Boolean getAdjustSize() { 42 | return adjustSize; 43 | } 44 | 45 | /** 46 | * @param arrows Array of arrows. 47 | * @return AmAngularGauge 48 | */ 49 | public AmAngularGauge setArrows(List arrows) { 50 | this.arrows = arrows; 51 | return this; 52 | } 53 | 54 | public List getArrows() { 55 | return arrows; 56 | } 57 | 58 | /** 59 | * @param axes Array of axes. 60 | * @return AmAngularGauge 61 | */ 62 | public AmAngularGauge setAxes(List axes) { 63 | this.axes = axes; 64 | return this; 65 | } 66 | 67 | public List getAxes() { 68 | return axes; 69 | } 70 | 71 | /** 72 | * @param clockWiseOnly In case you use gauge to create a clock, set this to true. 73 | * @return AmAngularGauge 74 | */ 75 | public AmAngularGauge setClockWiseOnly(boolean clockWiseOnly) { 76 | this.clockWiseOnly = clockWiseOnly; 77 | return this; 78 | } 79 | 80 | public Boolean getClockWiseOnly() { 81 | return clockWiseOnly; 82 | } 83 | 84 | /** 85 | * @param faceAlpha Gauge face opacity. 86 | * @return AmAngularGauge 87 | */ 88 | public AmAngularGauge setFaceAlpha(double faceAlpha) { 89 | this.faceAlpha = faceAlpha; 90 | return this; 91 | } 92 | 93 | public Double getFaceAlpha() { 94 | return faceAlpha; 95 | } 96 | 97 | /** 98 | * @param faceBorderAlpha Gauge face border opacity. 99 | * @return AmAngularGauge 100 | */ 101 | public AmAngularGauge setFaceBorderAlpha(double faceBorderAlpha) { 102 | this.faceBorderAlpha = faceBorderAlpha; 103 | return this; 104 | } 105 | 106 | public Double getFaceBorderAlpha() { 107 | return faceBorderAlpha; 108 | } 109 | 110 | /** 111 | * @param faceBorderColor Gauge face border color. 112 | * @return AmAngularGauge 113 | */ 114 | public AmAngularGauge setFaceBorderColor(Color faceBorderColor) { 115 | this.faceBorderColor = faceBorderColor; 116 | return this; 117 | } 118 | 119 | public Color getFaceBorderColor() { 120 | return faceBorderColor; 121 | } 122 | 123 | /** 124 | * @param faceBorderWidth Gauge face border width. 125 | * @return AmAngularGauge 126 | */ 127 | public AmAngularGauge setFaceBorderWidth(double faceBorderWidth) { 128 | this.faceBorderWidth = faceBorderWidth; 129 | return this; 130 | } 131 | 132 | public Double getFaceBorderWidth() { 133 | return faceBorderWidth; 134 | } 135 | 136 | /** 137 | * @param faceColor Gauge face color, requires faceAlpha > 0 138 | * @return AmAngularGauge 139 | */ 140 | public AmAngularGauge setFaceColor(Color faceColor) { 141 | this.faceColor = faceColor; 142 | return this; 143 | } 144 | 145 | public Color getFaceColor() { 146 | return faceColor; 147 | } 148 | 149 | /** 150 | * @param facePattern Gauge face image-pattern. Example: {"url":"../amcharts/patterns/black/pattern1.png", 151 | * "width":4, "height":4} 152 | * @return AmAngularGauge 153 | */ 154 | public AmAngularGauge setFacePattern(Object facePattern) { 155 | this.facePattern = facePattern; 156 | return this; 157 | } 158 | 159 | public Object getFacePattern() { 160 | return facePattern; 161 | } 162 | 163 | /** 164 | * @param gaugeX Gauge's horizontal position in pixel, origin is the center. Centered by default. 165 | * @return AmAngularGauge 166 | */ 167 | public AmAngularGauge setGaugeX(double gaugeX) { 168 | this.gaugeX = gaugeX; 169 | return this; 170 | } 171 | 172 | public Double getGaugeX() { 173 | return gaugeX; 174 | } 175 | 176 | /** 177 | * @param gaugeY Gauge's vertical position in pixel, origin is the center. Centered by default. 178 | * @return AmAngularGauge 179 | */ 180 | public AmAngularGauge setGaugeY(double gaugeY) { 181 | this.gaugeY = gaugeY; 182 | return this; 183 | } 184 | 185 | public Double getGaugeY() { 186 | return gaugeY; 187 | } 188 | 189 | /** 190 | * @param marginBottom Bottom spacing between chart and container. 191 | * @return AmAngularGauge 192 | */ 193 | public AmAngularGauge setMarginBottom(double marginBottom) { 194 | this.marginBottom = marginBottom; 195 | return this; 196 | } 197 | 198 | public Double getMarginBottom() { 199 | return marginBottom; 200 | } 201 | 202 | /** 203 | * @param marginLeft Left-hand spacing between chart and container. 204 | * @return AmAngularGauge 205 | */ 206 | public AmAngularGauge setMarginLeft(double marginLeft) { 207 | this.marginLeft = marginLeft; 208 | return this; 209 | } 210 | 211 | public Double getMarginLeft() { 212 | return marginLeft; 213 | } 214 | 215 | /** 216 | * @param marginRight Right-hand spacing between chart and container. 217 | * @return AmAngularGauge 218 | */ 219 | public AmAngularGauge setMarginRight(double marginRight) { 220 | this.marginRight = marginRight; 221 | return this; 222 | } 223 | 224 | public Double getMarginRight() { 225 | return marginRight; 226 | } 227 | 228 | /** 229 | * @param marginTop Top spacing between chart and container. 230 | * @return AmAngularGauge 231 | */ 232 | public AmAngularGauge setMarginTop(double marginTop) { 233 | this.marginTop = marginTop; 234 | return this; 235 | } 236 | 237 | public Double getMarginTop() { 238 | return marginTop; 239 | } 240 | 241 | /** 242 | * @param minRadius Minimum radius of a gauge. 243 | * @return AmAngularGauge 244 | */ 245 | public AmAngularGauge setMinRadius(double minRadius) { 246 | this.minRadius = minRadius; 247 | return this; 248 | } 249 | 250 | public Double getMinRadius() { 251 | return minRadius; 252 | } 253 | 254 | /** 255 | * @param startDuration Duration of arrow animation. 256 | * @return AmAngularGauge 257 | */ 258 | public AmAngularGauge setStartDuration(double startDuration) { 259 | this.startDuration = startDuration; 260 | return this; 261 | } 262 | 263 | public Double getStartDuration() { 264 | return startDuration; 265 | } 266 | 267 | /** 268 | * @param startEffect Transition effect of the arrows, possible effects: easeOutSine, easeInSine, elastic, 269 | * bounce. 270 | * @return AmAngularGauge 271 | */ 272 | public AmAngularGauge setStartEffect(String startEffect) { 273 | this.startEffect = startEffect; 274 | return this; 275 | } 276 | 277 | public String getStartEffect() { 278 | return startEffect; 279 | } 280 | 281 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/TrendLine.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | 8 | /** 9 | * Creates a trendline for AmSerialChart and AmXYChart charts which indicates the trend 10 | * of your data or covers some different purposes. Multiple can be assigned. 11 | */ 12 | 13 | public class TrendLine implements Serializable { 14 | private String balloonText; 15 | private Double dashLength; 16 | private String finalCategory; 17 | private Date finalDate; 18 | private Image finalImage; 19 | private Double finalValue; 20 | private Double finalXValue; 21 | private String id; 22 | private String initialCategory; 23 | private Date initialDate; 24 | private Image initialImage; 25 | private Double initialValue; 26 | private Double initialXValue; 27 | private Boolean isProtected; 28 | private Double lineAlpha; 29 | private Color lineColor; 30 | private Double lineThickness; 31 | private ValueAxis valueAxis; 32 | private ValueAxis valueAxisX; 33 | 34 | /** 35 | * @param balloonText When set, enables displaying a roll-over balloon. 36 | * @return TrendLine 37 | */ 38 | public TrendLine setBalloonText(String balloonText) { 39 | this.balloonText = balloonText; 40 | return this; 41 | } 42 | 43 | public String getBalloonText() { 44 | return balloonText; 45 | } 46 | 47 | /** 48 | * @param dashLength Dash length. 49 | * @return TrendLine 50 | */ 51 | public TrendLine setDashLength(double dashLength) { 52 | this.dashLength = dashLength; 53 | return this; 54 | } 55 | 56 | public Double getDashLength() { 57 | return dashLength; 58 | } 59 | 60 | /** 61 | * @param finalCategory String, equal to category value to which trend line should be drawn. It should be 62 | * used if chart doesn't parse dates. 63 | * @return TrendLine 64 | */ 65 | public TrendLine setFinalCategory(String finalCategory) { 66 | this.finalCategory = finalCategory; 67 | return this; 68 | } 69 | 70 | public String getFinalCategory() { 71 | return finalCategory; 72 | } 73 | 74 | /** 75 | * @param finalDate Date to which trend line should be drawn. It can be date string (using the same date 76 | * format as chart.dataDateFormat) or date object. 77 | * @return TrendLine 78 | */ 79 | public TrendLine setFinalDate(Date finalDate) { 80 | this.finalDate = finalDate; 81 | return this; 82 | } 83 | 84 | public Date getFinalDate() { 85 | return finalDate; 86 | } 87 | 88 | /** 89 | * @param finalImage Allows to add an image to the end of a trend line. 90 | * @return TrendLine 91 | */ 92 | public TrendLine setFinalImage(Image finalImage) { 93 | this.finalImage = finalImage; 94 | return this; 95 | } 96 | 97 | public Image getFinalImage() { 98 | return finalImage; 99 | } 100 | 101 | /** 102 | * @param finalValue Value at which trend line should end. 103 | * @return TrendLine 104 | */ 105 | public TrendLine setFinalValue(double finalValue) { 106 | this.finalValue = finalValue; 107 | return this; 108 | } 109 | 110 | public Double getFinalValue() { 111 | return finalValue; 112 | } 113 | 114 | /** 115 | * @param finalXValue Used by XY chart only. X value at which trend line should end. 116 | * @return TrendLine 117 | */ 118 | public TrendLine setFinalXValue(double finalXValue) { 119 | this.finalXValue = finalXValue; 120 | return this; 121 | } 122 | 123 | public Double getFinalXValue() { 124 | return finalXValue; 125 | } 126 | 127 | /** 128 | * @param id Unique id of a Trend line. You don't need to set it, unless you want to. 129 | * @return TrendLine 130 | */ 131 | public TrendLine setId(String id) { 132 | this.id = id; 133 | return this; 134 | } 135 | 136 | public String getId() { 137 | return id; 138 | } 139 | 140 | /** 141 | * @param initialCategory String, equal to category value from which trend line should start. It should be 142 | * used if chart doesn't parse dates. 143 | * @return TrendLine 144 | */ 145 | public TrendLine setInitialCategory(String initialCategory) { 146 | this.initialCategory = initialCategory; 147 | return this; 148 | } 149 | 150 | public String getInitialCategory() { 151 | return initialCategory; 152 | } 153 | 154 | /** 155 | * @param initialDate Date from which trend line should start. It can be date string (using the same date 156 | * format as chart.dataDateFormat) or date object. 157 | * @return TrendLine 158 | */ 159 | public TrendLine setInitialDate(Date initialDate) { 160 | this.initialDate = initialDate; 161 | return this; 162 | } 163 | 164 | public Date getInitialDate() { 165 | return initialDate; 166 | } 167 | 168 | /** 169 | * @param initialImage Allows to add an image to the beginning of a trend line. 170 | * @return TrendLine 171 | */ 172 | public TrendLine setInitialImage(Image initialImage) { 173 | this.initialImage = initialImage; 174 | return this; 175 | } 176 | 177 | public Image getInitialImage() { 178 | return initialImage; 179 | } 180 | 181 | /** 182 | * @param initialValue Value from which trend line should start. 183 | * @return TrendLine 184 | */ 185 | public TrendLine setInitialValue(double initialValue) { 186 | this.initialValue = initialValue; 187 | return this; 188 | } 189 | 190 | public Double getInitialValue() { 191 | return initialValue; 192 | } 193 | 194 | /** 195 | * @param initialXValue Used by XY chart only. X value from which trend line should start. 196 | * @return TrendLine 197 | */ 198 | public TrendLine setInitialXValue(double initialXValue) { 199 | this.initialXValue = initialXValue; 200 | return this; 201 | } 202 | 203 | public Double getInitialXValue() { 204 | return initialXValue; 205 | } 206 | 207 | /** 208 | * @param isProtected Used by Stock chart. If this property is set to true, this trend line won't be removed 209 | * when clicked on eraser tool. 210 | * @return TrendLine 211 | */ 212 | public TrendLine setIsProtected(boolean isProtected) { 213 | this.isProtected = isProtected; 214 | return this; 215 | } 216 | 217 | public Boolean getIsProtected() { 218 | return isProtected; 219 | } 220 | 221 | /** 222 | * @param lineAlpha Line opacity. 223 | * @return TrendLine 224 | */ 225 | public TrendLine setLineAlpha(double lineAlpha) { 226 | this.lineAlpha = lineAlpha; 227 | return this; 228 | } 229 | 230 | public Double getLineAlpha() { 231 | return lineAlpha; 232 | } 233 | 234 | /** 235 | * @param lineColor Line color. 236 | * @return TrendLine 237 | */ 238 | public TrendLine setLineColor(Color lineColor) { 239 | this.lineColor = lineColor; 240 | return this; 241 | } 242 | 243 | public Color getLineColor() { 244 | return lineColor; 245 | } 246 | 247 | /** 248 | * @param lineThickness Line thickness. 249 | * @return TrendLine 250 | */ 251 | public TrendLine setLineThickness(double lineThickness) { 252 | this.lineThickness = lineThickness; 253 | return this; 254 | } 255 | 256 | public Double getLineThickness() { 257 | return lineThickness; 258 | } 259 | 260 | /** 261 | * @param valueAxis Value axis of the trend line. Will use first value axis of the chart if not set any. 262 | * You can use a reference to the value axis object or id of value axis. 263 | * @return TrendLine 264 | */ 265 | public TrendLine setValueAxis(ValueAxis valueAxis) { 266 | this.valueAxis = valueAxis; 267 | return this; 268 | } 269 | 270 | public ValueAxis getValueAxis() { 271 | return valueAxis; 272 | } 273 | 274 | /** 275 | * @param valueAxisX Used by XY chart only. X axis of trend line. Will use first X axis of the chart if 276 | * not set any. You can use a reference to the value axis object or id of value axis. 277 | * @return TrendLine 278 | */ 279 | public TrendLine setValueAxisX(ValueAxis valueAxisX) { 280 | this.valueAxisX = valueAxisX; 281 | return this; 282 | } 283 | 284 | public ValueAxis getValueAxisX() { 285 | return valueAxisX; 286 | } 287 | 288 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/CategoryAxis.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Extension for AxisBase, gets automatically populated if none has been specified. 7 | */ 8 | 9 | public class CategoryAxis extends AxisBase { 10 | private Double autoRotateAngle; 11 | private Double autoRotateCount; 12 | private Boolean autoWrap; 13 | private String classNameField; 14 | private List dateFormats; 15 | private Boolean equalSpacing; 16 | private String forceShowField; 17 | private String gridPosition; 18 | private String labelColorField; 19 | private String minPeriod; 20 | private Boolean parseDates; 21 | private String position; 22 | private Boolean startOnAxis; 23 | private String tickPosition; 24 | private Boolean twoLineMode; 25 | private String widthField; 26 | 27 | /** 28 | * @param autoRotateAngle Angle of label rotation, if the number of series exceeds autoRotateCount and parseDates 29 | * is set to false. 30 | * @return CategoryAxis 31 | */ 32 | public CategoryAxis setAutoRotateAngle(double autoRotateAngle) { 33 | this.autoRotateAngle = autoRotateAngle; 34 | return this; 35 | } 36 | 37 | public Double getAutoRotateAngle() { 38 | return autoRotateAngle; 39 | } 40 | 41 | /** 42 | * @param autoRotateCount If the number of category axis items will exceed the autoRotateCount, the labels 43 | * will be rotated by autoRotateAngle degree. Works only if parseDates is false. 44 | * @return CategoryAxis 45 | */ 46 | public CategoryAxis setAutoRotateCount(double autoRotateCount) { 47 | this.autoRotateCount = autoRotateCount; 48 | return this; 49 | } 50 | 51 | public Double getAutoRotateCount() { 52 | return autoRotateCount; 53 | } 54 | 55 | /** 56 | * @param autoWrap Specifies if axis labels (only when it is horizontal) should be wrapped if they don't 57 | * fit in the allocated space. If axis is vertical, you should set axis.ignoreAxisWidth 58 | * to true in order this feature to work. 59 | * @return CategoryAxis 60 | */ 61 | public CategoryAxis setAutoWrap(boolean autoWrap) { 62 | this.autoWrap = autoWrap; 63 | return this; 64 | } 65 | 66 | public Boolean getAutoWrap() { 67 | return autoWrap; 68 | } 69 | 70 | /** 71 | * @param classNameField If this field is set and addClassNames is enabled, the category axis labels, ticks 72 | * and grid will have this class name set. NOTE: this will not work if the axis is date-based. 73 | * @return CategoryAxis 74 | */ 75 | public CategoryAxis setClassNameField(String classNameField) { 76 | this.classNameField = classNameField; 77 | return this; 78 | } 79 | 80 | public String getClassNameField() { 81 | return classNameField; 82 | } 83 | 84 | /** 85 | * @param dateFormats Date formats of different periods. Possible period values: fff - milliseconds, ss 86 | * - seconds, mm - minutes, hh - hours, DD - days, MM - months, WW - weeks, YYYY - years. 87 | * Check this page for date formatting strings. 88 | * @return CategoryAxis 89 | */ 90 | public CategoryAxis setDateFormats(List dateFormats) { 91 | this.dateFormats = dateFormats; 92 | return this; 93 | } 94 | 95 | public List getDateFormats() { 96 | return dateFormats; 97 | } 98 | 99 | /** 100 | * @param equalSpacing In case your category axis values are Date objects and parseDates is set to true, 101 | * the chart will parse dates and will place your data points at irregular intervals. 102 | * However if you want dates to be parsed (displayed on the axis, baloons, etc), but 103 | * data points to be placed at equal intervals (omiting dates with no data), set equalSpacing 104 | * to true. 105 | * @return CategoryAxis 106 | */ 107 | public CategoryAxis setEqualSpacing(boolean equalSpacing) { 108 | this.equalSpacing = equalSpacing; 109 | return this; 110 | } 111 | 112 | public Boolean getEqualSpacing() { 113 | return equalSpacing; 114 | } 115 | 116 | /** 117 | * @param forceShowField Field in data provider which specifies if the category value should always be shown. 118 | * For example: categoryAxis.forceShowField = "forceShow"; And in data: {category:"one", 119 | * forceShow:true, value:100} Note, this works only when parseDates is set to false. 120 | * @return CategoryAxis 121 | */ 122 | public CategoryAxis setForceShowField(String forceShowField) { 123 | this.forceShowField = forceShowField; 124 | return this; 125 | } 126 | 127 | public String getForceShowField() { 128 | return forceShowField; 129 | } 130 | 131 | /** 132 | * @param gridPosition Specifies if a grid line is placed on the center of a cell or on the beginning of 133 | * a cell. Possible values are: "start" and "middle" This setting doesn't work if parseDates 134 | * is set to true. 135 | * @return CategoryAxis 136 | */ 137 | public CategoryAxis setGridPosition(String gridPosition) { 138 | this.gridPosition = gridPosition; 139 | return this; 140 | } 141 | 142 | public String getGridPosition() { 143 | return gridPosition; 144 | } 145 | 146 | /** 147 | * @param labelColorField *You can use it to set color of a axis label. Works only with non-date-based data. 148 | * @return CategoryAxis 149 | */ 150 | public CategoryAxis setLabelColorField(String labelColorField) { 151 | this.labelColorField = labelColorField; 152 | return this; 153 | } 154 | 155 | public String getLabelColorField() { 156 | return labelColorField; 157 | } 158 | 159 | /** 160 | * @param minPeriod Specifies the shortest period of your data. This should be set only if parseDates 161 | * is set to "true". Possible period values: fff - milliseconds, ss - seconds, mm - 162 | * minutes, hh - hours, DD - days, MM - months, YYYY - years. It's also possible to 163 | * supply a number for increments, i.e. "15mm" which will instruct the chart that your 164 | * data is supplied in 15 minute increments. 165 | * @return CategoryAxis 166 | */ 167 | public CategoryAxis setMinPeriod(String minPeriod) { 168 | this.minPeriod = minPeriod; 169 | return this; 170 | } 171 | 172 | public String getMinPeriod() { 173 | return minPeriod; 174 | } 175 | 176 | /** 177 | * @param parseDates In case your category axis values are Date objects, set this to true. In this case 178 | * the chart will parse dates and will place your data points at irregular intervals. 179 | * If you want dates to be parsed, but data points to be placed at equal intervals, 180 | * set both parseDates and equalSpacing to true. Note: we recommend using JavaScript 181 | * timestamps to specify date/time. If you are specifying dates as strings in your data, 182 | * i.e. "2015-01-05", we strongly recommend setting dataDateFormat as well. Important: 183 | * If this is set to `true`, the data points needs to come pre-ordered in ascending 184 | * order. Data with incorrect order might result in visual and functional glitches on 185 | * the chart. 186 | * @return CategoryAxis 187 | */ 188 | public CategoryAxis setParseDates(boolean parseDates) { 189 | this.parseDates = parseDates; 190 | return this; 191 | } 192 | 193 | public Boolean getParseDates() { 194 | return parseDates; 195 | } 196 | 197 | /** 198 | * @param position Possible values are: "top", "bottom", "left", "right". If axis is vertical, default 199 | * position is "left". If axis is horizontal, default position is "bottom". 200 | * @return CategoryAxis 201 | */ 202 | public CategoryAxis setPosition(String position) { 203 | this.position = position; 204 | return this; 205 | } 206 | 207 | public String getPosition() { 208 | return position; 209 | } 210 | 211 | /** 212 | * @param startOnAxis Specifies whether the graph should start on axis or not. In case you display columns, 213 | * it is recommended to set this to false. If parseDates is set to true, startOnAxis 214 | * will allways be false, unless equalSpacing is set to true. 215 | * @return CategoryAxis 216 | */ 217 | public CategoryAxis setStartOnAxis(boolean startOnAxis) { 218 | this.startOnAxis = startOnAxis; 219 | return this; 220 | } 221 | 222 | public Boolean getStartOnAxis() { 223 | return startOnAxis; 224 | } 225 | 226 | /** 227 | * @param tickPosition Position of a axis tick. Available settings: middle, start. Works only with non-date-based 228 | * data. 229 | * @return CategoryAxis 230 | */ 231 | public CategoryAxis setTickPosition(String tickPosition) { 232 | this.tickPosition = tickPosition; 233 | return this; 234 | } 235 | 236 | public String getTickPosition() { 237 | return tickPosition; 238 | } 239 | 240 | /** 241 | * @param twoLineMode Works only when parseDates is set to true and equalSpacing is false. If you set it 242 | * to true, at the position where bigger period changes, category axis will display 243 | * date strings of bot small and big period, in two rows. 244 | * @return CategoryAxis 245 | */ 246 | public CategoryAxis setTwoLineMode(boolean twoLineMode) { 247 | this.twoLineMode = twoLineMode; 248 | return this; 249 | } 250 | 251 | public Boolean getTwoLineMode() { 252 | return twoLineMode; 253 | } 254 | 255 | /** 256 | * @param widthField You can specify relative width for your columns using this field and produce Mekko 257 | * chart using this new feature. 258 | * @return CategoryAxis 259 | */ 260 | public CategoryAxis setWidthField(String widthField) { 261 | this.widthField = widthField; 262 | return this; 263 | } 264 | 265 | public String getWidthField() { 266 | return widthField; 267 | } 268 | 269 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/helper/AmChartsWebsiteExtractor.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts.helper; 2 | 3 | import org.apache.commons.io.FileUtils; 4 | import org.apache.commons.io.FilenameUtils; 5 | import org.jsoup.Jsoup; 6 | import org.jsoup.nodes.Document; 7 | import org.jsoup.nodes.Element; 8 | import org.jsoup.select.Elements; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.util.*; 13 | 14 | public class AmChartsWebsiteExtractor { 15 | private final Map fields = new LinkedHashMap(); 16 | 17 | private final List imports = Arrays.asList("java.util.Date", "java.util.List", "org.json.JSONObject", "de.stekoe.amcharts.addition.Color", "java.io.Serializable"); 18 | private final Map inheritances = new HashMap(); 19 | private final boolean forceWrite = true; 20 | 21 | private final List properties = new ArrayList(); 22 | 23 | private static final String RESOURCES_CSV = "src/main/resources/csv/"; 24 | private static final String RESOURCES_JAVA = "src/main/resources/java/"; 25 | 26 | private String component; 27 | 28 | public static void main(String[] args) throws IOException { 29 | List components = new ArrayList(); 30 | 31 | Document doc = Jsoup.connect("http://docs.amcharts.com/3/javascriptcharts/") 32 | .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") 33 | .get(); 34 | 35 | Elements navListItems = doc.select(".nav.nav-list.left li"); 36 | for (Element element : navListItems) { 37 | String attr = element.attr("class"); 38 | if (!attr.equals("search-group") && !attr.equals("nav-header")) { 39 | components.add(element.text()); 40 | } 41 | } 42 | 43 | for (String component : components) { 44 | new AmChartsWebsiteExtractor().run(component); 45 | } 46 | System.out.println("Fin!"); 47 | } 48 | 49 | public void run(String component) throws IOException { 50 | this.component = component; 51 | System.out.print("Processing " + component + "... "); 52 | extractProperties(component); 53 | 54 | Status status = createJavaClassFile(component); 55 | if (status.SUCCESS.equals(status)) { 56 | System.out.println("done!"); 57 | } else if (status.DO_NOT_OVERWRITE.equals(status)) { 58 | System.out.println("alread exists!"); 59 | } else if (status.ERROR.equals(status)) { 60 | System.out.println("error!"); 61 | } else { 62 | System.out.println("unknown!"); 63 | } 64 | } 65 | 66 | private void extractProperties(String component) throws IOException { 67 | Document doc = Jsoup.connect("http://docs.amcharts.com/3/javascriptcharts/" + component) 68 | .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") 69 | .get(); 70 | 71 | Elements paragraphs = doc.select("div.inside p"); 72 | for (Element paragraph : paragraphs) { 73 | String text = paragraph.text(); 74 | if (text.toLowerCase().startsWith("inheritance:")) { 75 | String substring = extractSuperClass(text); 76 | inheritances.put(component, substring); 77 | break; 78 | } 79 | } 80 | 81 | Elements propertyTables = doc.select(".property-list"); 82 | if (propertyTables.size() != 0) { 83 | Element propertyTable = propertyTables.first(); 84 | Elements trs = propertyTable.getElementsByTag("tr"); 85 | if (trs.size() > 1) { 86 | for (int i = 1; i < trs.size(); i++) { 87 | Element tr = trs.get(i); 88 | String cssClass = tr.attr("class"); 89 | if (!cssClass.contains("inherited")) { 90 | Elements tds = tr.getElementsByTag("td"); 91 | 92 | Property property = new Property(); 93 | property.attribute = tds.get(0).text(); 94 | property.type = tds.get(1).text(); 95 | property.documentation = tds.get(3).text(); 96 | properties.add(property); 97 | } 98 | } 99 | } 100 | } 101 | } 102 | 103 | String extractSuperClass(String text) { 104 | String substring = text.substring(text.indexOf("→") + 1); 105 | int nextArrow = substring.indexOf("→"); 106 | if (nextArrow != -1) { 107 | substring = substring.substring(0, nextArrow); 108 | } 109 | return substring.trim(); 110 | } 111 | 112 | private Status createJavaClassFile(String component) { 113 | try { 114 | File outputFile = new File(RESOURCES_JAVA + component + ".java"); 115 | if (outputFile.exists() && !forceWrite) { 116 | return Status.DO_NOT_OVERWRITE; 117 | } 118 | 119 | for (Property prop : properties) { 120 | String type = prop.type; 121 | if (type.trim().isEmpty()) { 122 | continue; 123 | } 124 | if (type.equals("Number")) { 125 | type = "Double"; 126 | } else if (type.contains("Array")) { 127 | type = type.replace("Array[", "List<"); 128 | type = type.replace("]", ">"); 129 | } else if (type.equals("Number/String")) { 130 | type = "String"; 131 | } 132 | 133 | StringBuilder sb = new StringBuilder(); 134 | sb.append(" /**\n"); 135 | sb.append(" * " + breakDocumentation(prop.documentation, 80) + "\n"); 136 | sb.append(" **/\n"); 137 | String javaDoc = sb.toString(); 138 | String field = String.format(" private %s %s;", type, prop.attribute); 139 | String getMeth = createGetterFor(type, prop.attribute); 140 | String setMeth = createSetterFor(type, prop.attribute); 141 | 142 | Field f = new Field(); 143 | f.field = field; 144 | f.setter = setMeth; 145 | f.getter = getMeth; 146 | f.javadoc = (javaDoc == null) ? "" : javaDoc; 147 | 148 | fields.put(field, f); 149 | 150 | writeClassFile(outputFile); 151 | } 152 | } catch (IOException e) { 153 | e.printStackTrace(); 154 | return Status.ERROR; 155 | } 156 | 157 | return Status.SUCCESS; 158 | } 159 | 160 | private String breakDocumentation(String documentation, int breakPoint) { 161 | int length = documentation.length(); 162 | if (length <= breakPoint) 163 | return documentation; 164 | 165 | StringBuilder sb = new StringBuilder(); 166 | int curPos = 0; 167 | for (int cut = breakPoint; cut < documentation.length(); cut++) { 168 | if (documentation.charAt(cut) == ' ') { 169 | if (curPos != 0) { 170 | sb.append(" *"); 171 | } 172 | sb.append(documentation.substring(curPos, cut) + "\n"); 173 | curPos = cut; 174 | cut += breakPoint; 175 | } 176 | } 177 | sb.append(" *" + documentation.substring(curPos)); 178 | return sb.toString(); 179 | } 180 | 181 | private void writeClassFile(File outputFile) throws IOException { 182 | String className = FilenameUtils.getBaseName(outputFile.getAbsolutePath()); 183 | 184 | String superClass = inheritances.get(className); 185 | String inheritance = " implements Serializable"; 186 | if (hasSuperClass(className)) { 187 | inheritance = " extends " + superClass; 188 | } 189 | 190 | FileUtils.write(outputFile, "package de.stekoe.amcharts;\n\n"); 191 | 192 | for (String _import : imports) { 193 | FileUtils.write(outputFile, "import " + _import + ";\n", true); 194 | } 195 | FileUtils.write(outputFile, "\n", true); 196 | 197 | FileUtils.write(outputFile, "public class " + className + inheritance + " {\n", true); 198 | 199 | // Write all fields 200 | for (String field : fields.keySet()) { 201 | FileUtils.write(outputFile, field + "\n", true); 202 | } 203 | FileUtils.write(outputFile, "\n", true); 204 | 205 | // Write doc, getter and setter blockwise 206 | for (String field : fields.keySet()) { 207 | Field f = fields.get(field); 208 | FileUtils.write(outputFile, f.javadoc, true); 209 | FileUtils.write(outputFile, f.setter, true); 210 | FileUtils.write(outputFile, f.getter, true); 211 | FileUtils.write(outputFile, "\n", true); 212 | } 213 | 214 | FileUtils.write(outputFile, "}", true); 215 | } 216 | 217 | private boolean hasSuperClass(Object className) { 218 | return inheritances.get(className) != null; 219 | } 220 | 221 | private String createSetterFor(String type, String field) { 222 | StringBuilder sb = new StringBuilder(); 223 | 224 | String t = type; 225 | if (type.equals("Boolean")) { 226 | t = "boolean"; 227 | } else if (type.equals("Double")) { 228 | t = "double"; 229 | } 230 | 231 | sb.append(" public " + component + " set" + capitalize(field) + "(" + t + " " + field + ") {\n"); 232 | sb.append(" this." + field + " = " + field + ";\n"); 233 | sb.append(" return this;\n"); 234 | sb.append(" }\n"); 235 | return sb.toString(); 236 | } 237 | 238 | private String createGetterFor(String type, String field) { 239 | StringBuilder sb = new StringBuilder(); 240 | sb.append(" public " + type + " get" + capitalize(field) + "() {\n"); 241 | sb.append(" return " + field + ";\n"); 242 | sb.append(" }\n"); 243 | 244 | return sb.toString(); 245 | } 246 | 247 | private String capitalize(String field) { 248 | String first = field.substring(0, 1); 249 | String rest = field.substring(1); 250 | return first.toUpperCase() + rest; 251 | } 252 | 253 | class Property { 254 | public String attribute; 255 | public String type; 256 | public String documentation; 257 | } 258 | 259 | class Field { 260 | public String field; 261 | public String javadoc; 262 | public String getter; 263 | public String setter; 264 | } 265 | } 266 | -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmSerialChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Extension for AmRectangularChart to create line, area, column, bar, step line, smoothed 7 | * line, candlestick and OHLC charts. The charts support multiple axes with simple or 8 | * logarithmic scales, the data points can be displayed at equal / irregular intervals 9 | * or on timeline basis. 10 | */ 11 | 12 | public class AmSerialChart extends AmRectangularChart { 13 | private String balloonDateFormat; 14 | private Double bezierX; 15 | private CategoryAxis categoryAxis; 16 | private String categoryField; 17 | private Double columnSpacing; 18 | private Double columnSpacing3D; 19 | private Double columnWidth; 20 | private String dataDateFormat; 21 | private Date endDate; 22 | private Double endIndex; 23 | private Double maxSelectedSeries; 24 | private Double maxSelectedTime; 25 | private Double minSelectedTime; 26 | private Boolean mouseWheelScrollEnabled; 27 | private Boolean mouseWheelZoomEnabled; 28 | private Boolean rotate; 29 | private Date startDate; 30 | private Double startIndex; 31 | private ChartScrollbar valueScrollbar; 32 | private Boolean zoomOutOnDataUpdate; 33 | 34 | /** 35 | * @param balloonDateFormat *Date format of the graph balloon (if chart parses dates and you don't use chartCursor). 36 | * @return AmSerialChart 37 | */ 38 | public AmSerialChart setBalloonDateFormat(String balloonDateFormat) { 39 | this.balloonDateFormat = balloonDateFormat; 40 | return this; 41 | } 42 | 43 | public String getBalloonDateFormat() { 44 | return balloonDateFormat; 45 | } 46 | 47 | /** 48 | * @param bezierX Horizontal tension of bezier (used by smoothed line). If not defined, chart adjust 49 | * tension by itself, taking in to account if chart is rotated or not. Allowed values 50 | * 1 - Infinity 51 | * @return AmSerialChart 52 | */ 53 | public AmSerialChart setBezierX(double bezierX) { 54 | this.bezierX = bezierX; 55 | return this; 56 | } 57 | 58 | public Double getBezierX() { 59 | return bezierX; 60 | } 61 | 62 | /** 63 | * @param categoryAxis Read-only. Chart creates category axis itself. If you want to change some properties, 64 | * you should get this axis from the chart and set properties to this object. 65 | * @return AmSerialChart 66 | */ 67 | public AmSerialChart setCategoryAxis(CategoryAxis categoryAxis) { 68 | this.categoryAxis = categoryAxis; 69 | return this; 70 | } 71 | 72 | public CategoryAxis getCategoryAxis() { 73 | return categoryAxis; 74 | } 75 | 76 | /** 77 | * @param categoryField Category field name tells the chart the name of the field in your dataProvider object 78 | * which will be used for category axis values. 79 | * @return AmSerialChart 80 | */ 81 | public AmSerialChart setCategoryField(String categoryField) { 82 | this.categoryField = categoryField; 83 | return this; 84 | } 85 | 86 | public String getCategoryField() { 87 | return categoryField; 88 | } 89 | 90 | /** 91 | * @param columnSpacing The gap in pixels between two columns of the same category. 92 | * @return AmSerialChart 93 | */ 94 | public AmSerialChart setColumnSpacing(double columnSpacing) { 95 | this.columnSpacing = columnSpacing; 96 | return this; 97 | } 98 | 99 | public Double getColumnSpacing() { 100 | return columnSpacing; 101 | } 102 | 103 | /** 104 | * @param columnSpacing3D Space between 3D stacked columns. 105 | * @return AmSerialChart 106 | */ 107 | public AmSerialChart setColumnSpacing3D(double columnSpacing3D) { 108 | this.columnSpacing3D = columnSpacing3D; 109 | return this; 110 | } 111 | 112 | public Double getColumnSpacing3D() { 113 | return columnSpacing3D; 114 | } 115 | 116 | /** 117 | * @param columnWidth Relative width of columns. Value range is 0 - 1. 118 | * @return AmSerialChart 119 | */ 120 | public AmSerialChart setColumnWidth(double columnWidth) { 121 | this.columnWidth = columnWidth; 122 | return this; 123 | } 124 | 125 | public Double getColumnWidth() { 126 | return columnWidth; 127 | } 128 | 129 | /** 130 | * @param dataDateFormat Even if your chart parses dates, you can pass them as strings in your data – all 131 | * you need to do is to set data date format and the chart will parse dates to date 132 | * objects. Check this page for available formats. Please note that two-digit years 133 | * (YY) as well as literal month names (MMM) are NOT supported in this setting. 134 | * @return AmSerialChart 135 | */ 136 | public AmSerialChart setDataDateFormat(String dataDateFormat) { 137 | this.dataDateFormat = dataDateFormat; 138 | return this; 139 | } 140 | 141 | public String getDataDateFormat() { 142 | return dataDateFormat; 143 | } 144 | 145 | /** 146 | * @param endDate Read-only. If category axis parses dates endDate indicates date to which the chart 147 | * is currently displayed. 148 | * @return AmSerialChart 149 | */ 150 | public AmSerialChart setEndDate(Date endDate) { 151 | this.endDate = endDate; 152 | return this; 153 | } 154 | 155 | public Date getEndDate() { 156 | return endDate; 157 | } 158 | 159 | /** 160 | * @param endIndex Read-only. Category index to which the chart is currently displayed. 161 | * @return AmSerialChart 162 | */ 163 | public AmSerialChart setEndIndex(double endIndex) { 164 | this.endIndex = endIndex; 165 | return this; 166 | } 167 | 168 | public Double getEndIndex() { 169 | return endIndex; 170 | } 171 | 172 | /** 173 | * @param maxSelectedSeries Maximum number of series allowed to select. 174 | * @return AmSerialChart 175 | */ 176 | public AmSerialChart setMaxSelectedSeries(double maxSelectedSeries) { 177 | this.maxSelectedSeries = maxSelectedSeries; 178 | return this; 179 | } 180 | 181 | public Double getMaxSelectedSeries() { 182 | return maxSelectedSeries; 183 | } 184 | 185 | /** 186 | * @param maxSelectedTime The longest time span allowed to select (in milliseconds) for example, 259200000 187 | * will limit selection to 3 days. Works if equalSpacing is set to false (default). 188 | * @return AmSerialChart 189 | */ 190 | public AmSerialChart setMaxSelectedTime(double maxSelectedTime) { 191 | this.maxSelectedTime = maxSelectedTime; 192 | return this; 193 | } 194 | 195 | public Double getMaxSelectedTime() { 196 | return maxSelectedTime; 197 | } 198 | 199 | /** 200 | * @param minSelectedTime The shortest time span allowed to select (in milliseconds) for example, 1000 will 201 | * limit selection to 1 second. Works if equalSpacing is set to false (default). 202 | * @return AmSerialChart 203 | */ 204 | public AmSerialChart setMinSelectedTime(double minSelectedTime) { 205 | this.minSelectedTime = minSelectedTime; 206 | return this; 207 | } 208 | 209 | public Double getMinSelectedTime() { 210 | return minSelectedTime; 211 | } 212 | 213 | /** 214 | * @param mouseWheelScrollEnabled Specifies if scrolling of a chart with mouse wheel is enabled. If you press shift 215 | * while rotating mouse wheel, the chart will zoom-in/out. 216 | * @return AmSerialChart 217 | */ 218 | public AmSerialChart setMouseWheelScrollEnabled(boolean mouseWheelScrollEnabled) { 219 | this.mouseWheelScrollEnabled = mouseWheelScrollEnabled; 220 | return this; 221 | } 222 | 223 | public Boolean getMouseWheelScrollEnabled() { 224 | return mouseWheelScrollEnabled; 225 | } 226 | 227 | /** 228 | * @param mouseWheelZoomEnabled Specifies if zooming of a chart with mouse wheel is enabled. If you press shift while 229 | * rotating mouse wheel, the chart will scroll. 230 | * @return AmSerialChart 231 | */ 232 | public AmSerialChart setMouseWheelZoomEnabled(boolean mouseWheelZoomEnabled) { 233 | this.mouseWheelZoomEnabled = mouseWheelZoomEnabled; 234 | return this; 235 | } 236 | 237 | public Boolean getMouseWheelZoomEnabled() { 238 | return mouseWheelZoomEnabled; 239 | } 240 | 241 | /** 242 | * @param rotate If you set this to true, the chart will be rotated by 90 degrees (the columns will 243 | * become bars). 244 | * @return AmSerialChart 245 | */ 246 | public AmSerialChart setRotate(boolean rotate) { 247 | this.rotate = rotate; 248 | return this; 249 | } 250 | 251 | public Boolean getRotate() { 252 | return rotate; 253 | } 254 | 255 | /** 256 | * @param startDate Read-only. If category axis parses dates startDate indicates date from which the 257 | * chart is currently displayed. 258 | * @return AmSerialChart 259 | */ 260 | public AmSerialChart setStartDate(Date startDate) { 261 | this.startDate = startDate; 262 | return this; 263 | } 264 | 265 | public Date getStartDate() { 266 | return startDate; 267 | } 268 | 269 | /** 270 | * @param startIndex Read-only. Category index from which the chart is currently displayed. 271 | * @return AmSerialChart 272 | */ 273 | public AmSerialChart setStartIndex(double startIndex) { 274 | this.startIndex = startIndex; 275 | return this; 276 | } 277 | 278 | public Double getStartIndex() { 279 | return startIndex; 280 | } 281 | 282 | /** 283 | * @param valueScrollbar Value scrollbar, enables scrolling value axes. 284 | * @return AmSerialChart 285 | */ 286 | public AmSerialChart setValueScrollbar(ChartScrollbar valueScrollbar) { 287 | this.valueScrollbar = valueScrollbar; 288 | return this; 289 | } 290 | 291 | public ChartScrollbar getValueScrollbar() { 292 | return valueScrollbar; 293 | } 294 | 295 | /** 296 | * @param zoomOutOnDataUpdate Specifies if chart should zoom-out when data is updated. 297 | * @return AmSerialChart 298 | */ 299 | public AmSerialChart setZoomOutOnDataUpdate(boolean zoomOutOnDataUpdate) { 300 | this.zoomOutOnDataUpdate = zoomOutOnDataUpdate; 301 | return this; 302 | } 303 | 304 | public Boolean getZoomOutOnDataUpdate() { 305 | return zoomOutOnDataUpdate; 306 | } 307 | 308 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/Guide.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | 8 | /** 9 | * Creates a horizontal/vertical guideline-/area for AmSerialChart, AmXYChart and AmRadarChart 10 | * charts, automatically adapts it's settings from the axes if none has been specified. 11 | */ 12 | 13 | public class Guide implements Serializable { 14 | private Boolean above; 15 | private Double angle; 16 | private Color balloonColor; 17 | private String balloonText; 18 | private Boolean boldLabel; 19 | private String category; 20 | private Color color; 21 | private Double dashLength; 22 | private Date date; 23 | private Boolean expand; 24 | private Double fillAlpha; 25 | private Color fillColor; 26 | private Double fontSize; 27 | private String id; 28 | private Boolean inside; 29 | private String label; 30 | private Double labelRotation; 31 | private Double lineAlpha; 32 | private Color lineColor; 33 | private Double lineThickness; 34 | private String position; 35 | private Double tickLength; 36 | private Double toAngle; 37 | private String toCategory; 38 | private Date toDate; 39 | private Double toValue; 40 | private Double value; 41 | private ValueAxis valueAxis; 42 | 43 | /** 44 | * @param above If you set it to true, the guide will be displayed above the graphs. 45 | * @return Guide 46 | */ 47 | public Guide setAbove(boolean above) { 48 | this.above = above; 49 | return this; 50 | } 51 | 52 | public Boolean getAbove() { 53 | return above; 54 | } 55 | 56 | /** 57 | * @param angle Radar chart only. Specifies angle at which guide should start. Affects only fills, 58 | * not lines. 59 | * @return Guide 60 | */ 61 | public Guide setAngle(double angle) { 62 | this.angle = angle; 63 | return this; 64 | } 65 | 66 | public Double getAngle() { 67 | return angle; 68 | } 69 | 70 | /** 71 | * @param balloonColor Baloon fill color. 72 | * @return Guide 73 | */ 74 | public Guide setBalloonColor(Color balloonColor) { 75 | this.balloonColor = balloonColor; 76 | return this; 77 | } 78 | 79 | public Color getBalloonColor() { 80 | return balloonColor; 81 | } 82 | 83 | /** 84 | * @param balloonText The text which will be displayed if the user rolls-over the guide. 85 | * @return Guide 86 | */ 87 | public Guide setBalloonText(String balloonText) { 88 | this.balloonText = balloonText; 89 | return this; 90 | } 91 | 92 | public String getBalloonText() { 93 | return balloonText; 94 | } 95 | 96 | /** 97 | * @param boldLabel Specifies if label should be bold or not. 98 | * @return Guide 99 | */ 100 | public Guide setBoldLabel(boolean boldLabel) { 101 | this.boldLabel = boldLabel; 102 | return this; 103 | } 104 | 105 | public Boolean getBoldLabel() { 106 | return boldLabel; 107 | } 108 | 109 | /** 110 | * @param category Category of the guide (in case the guide is for category axis). 111 | * @return Guide 112 | */ 113 | public Guide setCategory(String category) { 114 | this.category = category; 115 | return this; 116 | } 117 | 118 | public String getCategory() { 119 | return category; 120 | } 121 | 122 | /** 123 | * @param color Color of a guide label. 124 | * @return Guide 125 | */ 126 | public Guide setColor(Color color) { 127 | this.color = color; 128 | return this; 129 | } 130 | 131 | public Color getColor() { 132 | return color; 133 | } 134 | 135 | /** 136 | * @param dashLength Dash length. 137 | * @return Guide 138 | */ 139 | public Guide setDashLength(double dashLength) { 140 | this.dashLength = dashLength; 141 | return this; 142 | } 143 | 144 | public Double getDashLength() { 145 | return dashLength; 146 | } 147 | 148 | /** 149 | * @param date Date of the guide (in case the guide is for category axis and parseDates is set to 150 | * true). 151 | * @return Guide 152 | */ 153 | public Guide setDate(Date date) { 154 | this.date = date; 155 | return this; 156 | } 157 | 158 | public Date getDate() { 159 | return date; 160 | } 161 | 162 | /** 163 | * @param expand Works if a guide is added to CategoryAxis and this axis is non-date-based. If you 164 | * set it to true, the guide will start (or be placed, if it's not a fill) on the beginning 165 | * of the category cell and will end at the end of toCategory cell. 166 | * @return Guide 167 | */ 168 | public Guide setExpand(boolean expand) { 169 | this.expand = expand; 170 | return this; 171 | } 172 | 173 | public Boolean getExpand() { 174 | return expand; 175 | } 176 | 177 | /** 178 | * @param fillAlpha Fill opacity. Value range is 0 - 1. 179 | * @return Guide 180 | */ 181 | public Guide setFillAlpha(double fillAlpha) { 182 | this.fillAlpha = fillAlpha; 183 | return this; 184 | } 185 | 186 | public Double getFillAlpha() { 187 | return fillAlpha; 188 | } 189 | 190 | /** 191 | * @param fillColor Fill color. 192 | * @return Guide 193 | */ 194 | public Guide setFillColor(Color fillColor) { 195 | this.fillColor = fillColor; 196 | return this; 197 | } 198 | 199 | public Color getFillColor() { 200 | return fillColor; 201 | } 202 | 203 | /** 204 | * @param fontSize Font size of guide label. 205 | * @return Guide 206 | */ 207 | public Guide setFontSize(double fontSize) { 208 | this.fontSize = fontSize; 209 | return this; 210 | } 211 | 212 | public Double getFontSize() { 213 | return fontSize; 214 | } 215 | 216 | /** 217 | * @param id Unique id of a Guide. You don't need to set it, unless you want to. 218 | * @return Guide 219 | */ 220 | public Guide setId(String id) { 221 | this.id = id; 222 | return this; 223 | } 224 | 225 | public String getId() { 226 | return id; 227 | } 228 | 229 | /** 230 | * @param inside Specifies whether label should be placed inside or outside plot area. 231 | * @return Guide 232 | */ 233 | public Guide setInside(boolean inside) { 234 | this.inside = inside; 235 | return this; 236 | } 237 | 238 | public Boolean getInside() { 239 | return inside; 240 | } 241 | 242 | /** 243 | * @param label The label which will be displayed near the guide. 244 | * @return Guide 245 | */ 246 | public Guide setLabel(String label) { 247 | this.label = label; 248 | return this; 249 | } 250 | 251 | public String getLabel() { 252 | return label; 253 | } 254 | 255 | /** 256 | * @param labelRotation Rotation angle of a guide label. 257 | * @return Guide 258 | */ 259 | public Guide setLabelRotation(double labelRotation) { 260 | this.labelRotation = labelRotation; 261 | return this; 262 | } 263 | 264 | public Double getLabelRotation() { 265 | return labelRotation; 266 | } 267 | 268 | /** 269 | * @param lineAlpha Line opacity. 270 | * @return Guide 271 | */ 272 | public Guide setLineAlpha(double lineAlpha) { 273 | this.lineAlpha = lineAlpha; 274 | return this; 275 | } 276 | 277 | public Double getLineAlpha() { 278 | return lineAlpha; 279 | } 280 | 281 | /** 282 | * @param lineColor Line color. 283 | * @return Guide 284 | */ 285 | public Guide setLineColor(Color lineColor) { 286 | this.lineColor = lineColor; 287 | return this; 288 | } 289 | 290 | public Color getLineColor() { 291 | return lineColor; 292 | } 293 | 294 | /** 295 | * @param lineThickness Line thickness. 296 | * @return Guide 297 | */ 298 | public Guide setLineThickness(double lineThickness) { 299 | this.lineThickness = lineThickness; 300 | return this; 301 | } 302 | 303 | public Double getLineThickness() { 304 | return lineThickness; 305 | } 306 | 307 | /** 308 | * @param position Position of guide label. Possible values are "left" or "right" for horizontal axis 309 | * and "top" or "bottom" for vertical axis. 310 | * @return Guide 311 | */ 312 | public Guide setPosition(String position) { 313 | this.position = position; 314 | return this; 315 | } 316 | 317 | public String getPosition() { 318 | return position; 319 | } 320 | 321 | /** 322 | * @param tickLength Tick length. 323 | * @return Guide 324 | */ 325 | public Guide setTickLength(double tickLength) { 326 | this.tickLength = tickLength; 327 | return this; 328 | } 329 | 330 | public Double getTickLength() { 331 | return tickLength; 332 | } 333 | 334 | /** 335 | * @param toAngle Radar chart only. Specifies angle at which guide should end. Affects only fills, 336 | * not lines. 337 | * @return Guide 338 | */ 339 | public Guide setToAngle(double toAngle) { 340 | this.toAngle = toAngle; 341 | return this; 342 | } 343 | 344 | public Double getToAngle() { 345 | return toAngle; 346 | } 347 | 348 | /** 349 | * @param toCategory "To" category of the guide (in case the guide is for category axis). 350 | * @return Guide 351 | */ 352 | public Guide setToCategory(String toCategory) { 353 | this.toCategory = toCategory; 354 | return this; 355 | } 356 | 357 | public String getToCategory() { 358 | return toCategory; 359 | } 360 | 361 | /** 362 | * @param toDate "To" date of the guide (in case the guide is for category axis and parseDates is 363 | * set to true) If you have both date and toDate, the space between these two dates 364 | * can be filled with color. 365 | * @return Guide 366 | */ 367 | public Guide setToDate(Date toDate) { 368 | this.toDate = toDate; 369 | return this; 370 | } 371 | 372 | public Date getToDate() { 373 | return toDate; 374 | } 375 | 376 | /** 377 | * @param toValue "To" value of the guide (in case the guide is for value axis). 378 | * @return Guide 379 | */ 380 | public Guide setToValue(double toValue) { 381 | this.toValue = toValue; 382 | return this; 383 | } 384 | 385 | public Double getToValue() { 386 | return toValue; 387 | } 388 | 389 | /** 390 | * @param value Value of the guide (in case the guide is for value axis). 391 | * @return Guide 392 | */ 393 | public Guide setValue(double value) { 394 | this.value = value; 395 | return this; 396 | } 397 | 398 | public Double getValue() { 399 | return value; 400 | } 401 | 402 | /** 403 | * @param valueAxis Value axis of a guide. As you can add guides directly to the chart, you might need 404 | * to specify which which value axis should be used. 405 | * @return Guide 406 | */ 407 | public Guide setValueAxis(ValueAxis valueAxis) { 408 | this.valueAxis = valueAxis; 409 | return this; 410 | } 411 | 412 | public ValueAxis getValueAxis() { 413 | return valueAxis; 414 | } 415 | 416 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmBalloon.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Creates the balloons ( tooltips ) of the chart, It follows the mouse cursor when 9 | * you roll-over the data items. The framework generates the instances automatically 10 | * you only need to adjust the appearance to your needs. 11 | */ 12 | 13 | public class AmBalloon implements Serializable { 14 | private Boolean adjustBorderColor; 15 | private Double animationDuration; 16 | private Double borderAlpha; 17 | private Color borderColor; 18 | private Double borderThickness; 19 | private Color color; 20 | private Double cornerRadius; 21 | private Boolean disableMouseEvents; 22 | private Boolean drop; 23 | private Boolean enabled; 24 | private Double fadeOutDuration; 25 | private Double fillAlpha; 26 | private Color fillColor; 27 | private Boolean fixedPosition; 28 | private Double fontSize; 29 | private Double horizontalPadding; 30 | private Double maxWidth; 31 | private Double offsetX; 32 | private Double offsetY; 33 | private String pointerOrientation; 34 | private Double pointerWidth; 35 | private Double shadowAlpha; 36 | private Color shadowColor; 37 | private Boolean showBullet; 38 | private String textAlign; 39 | private Double verticalPadding; 40 | 41 | /** 42 | * @param adjustBorderColor If this is set to true, border color instead of background color will be changed 43 | * when user rolls-over the slice, graph, etc. 44 | * @return AmBalloon 45 | */ 46 | public AmBalloon setAdjustBorderColor(boolean adjustBorderColor) { 47 | this.adjustBorderColor = adjustBorderColor; 48 | return this; 49 | } 50 | 51 | public Boolean getAdjustBorderColor() { 52 | return adjustBorderColor; 53 | } 54 | 55 | /** 56 | * @param animationDuration Duration of balloon movement from previous point to current point, in seconds. 57 | * @return AmBalloon 58 | */ 59 | public AmBalloon setAnimationDuration(double animationDuration) { 60 | this.animationDuration = animationDuration; 61 | return this; 62 | } 63 | 64 | public Double getAnimationDuration() { 65 | return animationDuration; 66 | } 67 | 68 | /** 69 | * @param borderAlpha Balloon border opacity. Value range is 0 - 1. 70 | * @return AmBalloon 71 | */ 72 | public AmBalloon setBorderAlpha(double borderAlpha) { 73 | this.borderAlpha = borderAlpha; 74 | return this; 75 | } 76 | 77 | public Double getBorderAlpha() { 78 | return borderAlpha; 79 | } 80 | 81 | /** 82 | * @param borderColor Balloon border color. Will only be used of adjustBorderColor is false. 83 | * @return AmBalloon 84 | */ 85 | public AmBalloon setBorderColor(Color borderColor) { 86 | this.borderColor = borderColor; 87 | return this; 88 | } 89 | 90 | public Color getBorderColor() { 91 | return borderColor; 92 | } 93 | 94 | /** 95 | * @param borderThickness Balloon border thickness. 96 | * @return AmBalloon 97 | */ 98 | public AmBalloon setBorderThickness(double borderThickness) { 99 | this.borderThickness = borderThickness; 100 | return this; 101 | } 102 | 103 | public Double getBorderThickness() { 104 | return borderThickness; 105 | } 106 | 107 | /** 108 | * @param color Color of text in the balloon. 109 | * @return AmBalloon 110 | */ 111 | public AmBalloon setColor(Color color) { 112 | this.color = color; 113 | return this; 114 | } 115 | 116 | public Color getColor() { 117 | return color; 118 | } 119 | 120 | /** 121 | * @param cornerRadius Balloon corner radius. 122 | * @return AmBalloon 123 | */ 124 | public AmBalloon setCornerRadius(double cornerRadius) { 125 | this.cornerRadius = cornerRadius; 126 | return this; 127 | } 128 | 129 | public Double getCornerRadius() { 130 | return cornerRadius; 131 | } 132 | 133 | /** 134 | * @param disableMouseEvents If your balloon has links, you have to set this to false in order for those links 135 | * to be clickable. 136 | * @return AmBalloon 137 | */ 138 | public AmBalloon setDisableMouseEvents(boolean disableMouseEvents) { 139 | this.disableMouseEvents = disableMouseEvents; 140 | return this; 141 | } 142 | 143 | public Boolean getDisableMouseEvents() { 144 | return disableMouseEvents; 145 | } 146 | 147 | /** 148 | * @param drop Allows having drop-shaped balloons. Note, these balloons will not check for overlapping 149 | * with other balloons, or if they go outside plot area. It also does not change pointer 150 | * orientation automatically based on its vertical position like regular balloons do. 151 | * You can use pointerOrientation property if you want it to point to different direction. 152 | * Not supported by IE8. 153 | * @return AmBalloon 154 | */ 155 | public AmBalloon setDrop(boolean drop) { 156 | this.drop = drop; 157 | return this; 158 | } 159 | 160 | public Boolean getDrop() { 161 | return drop; 162 | } 163 | 164 | /** 165 | * @param enabled Use this property to disable balloons for certain value axes. I.e.: "valueAxes": 166 | * [{ 167 | * // ... 168 | * // value balloons are shown 169 | * }, { 170 | * // ... 171 | * "balloon": { 172 | * "enabled": 173 | * false 174 | * } 175 | * // value balloons are not shown 176 | * }] 177 | * @return AmBalloon 178 | */ 179 | public AmBalloon setEnabled(boolean enabled) { 180 | this.enabled = enabled; 181 | return this; 182 | } 183 | 184 | public Boolean getEnabled() { 185 | return enabled; 186 | } 187 | 188 | /** 189 | * @param fadeOutDuration Duration of a fade out animation, in seconds. 190 | * @return AmBalloon 191 | */ 192 | public AmBalloon setFadeOutDuration(double fadeOutDuration) { 193 | this.fadeOutDuration = fadeOutDuration; 194 | return this; 195 | } 196 | 197 | public Double getFadeOutDuration() { 198 | return fadeOutDuration; 199 | } 200 | 201 | /** 202 | * @param fillAlpha Balloon background opacity. 203 | * @return AmBalloon 204 | */ 205 | public AmBalloon setFillAlpha(double fillAlpha) { 206 | this.fillAlpha = fillAlpha; 207 | return this; 208 | } 209 | 210 | public Double getFillAlpha() { 211 | return fillAlpha; 212 | } 213 | 214 | /** 215 | * @param fillColor Balloon background color. Usually balloon background color is set by the chart. Only 216 | * if "adjustBorderColor" is "true" this color will be used. 217 | * @return AmBalloon 218 | */ 219 | public AmBalloon setFillColor(Color fillColor) { 220 | this.fillColor = fillColor; 221 | return this; 222 | } 223 | 224 | public Color getFillColor() { 225 | return fillColor; 226 | } 227 | 228 | /** 229 | * @param fixedPosition Specifies if balloon should follow mouse when hovering the slice/column/bullet or 230 | * stay in fixed position (this does not affect balloon behavior if ChartCursor is used). 231 | * Note: This setting is ignored in JavaScript Maps. 232 | * @return AmBalloon 233 | */ 234 | public AmBalloon setFixedPosition(boolean fixedPosition) { 235 | this.fixedPosition = fixedPosition; 236 | return this; 237 | } 238 | 239 | public Boolean getFixedPosition() { 240 | return fixedPosition; 241 | } 242 | 243 | /** 244 | * @param fontSize Size of text in the balloon. Chart's fontSize is used by default. 245 | * @return AmBalloon 246 | */ 247 | public AmBalloon setFontSize(double fontSize) { 248 | this.fontSize = fontSize; 249 | return this; 250 | } 251 | 252 | public Double getFontSize() { 253 | return fontSize; 254 | } 255 | 256 | /** 257 | * @param horizontalPadding Horizontal padding of the balloon. 258 | * @return AmBalloon 259 | */ 260 | public AmBalloon setHorizontalPadding(double horizontalPadding) { 261 | this.horizontalPadding = horizontalPadding; 262 | return this; 263 | } 264 | 265 | public Double getHorizontalPadding() { 266 | return horizontalPadding; 267 | } 268 | 269 | /** 270 | * @param maxWidth Maximum width of a balloon. 271 | * @return AmBalloon 272 | */ 273 | public AmBalloon setMaxWidth(double maxWidth) { 274 | this.maxWidth = maxWidth; 275 | return this; 276 | } 277 | 278 | public Double getMaxWidth() { 279 | return maxWidth; 280 | } 281 | 282 | /** 283 | * @param offsetX Defines horizontal distance from mouse pointer to balloon pointer. If you set it 284 | * to a small value, the balloon might flicker, as mouse might lose focus on hovered 285 | * object. NOTE: this setting is ignored unless fixedPosition is set to false or Chart 286 | * Cursor is enabled. 287 | * @return AmBalloon 288 | */ 289 | public AmBalloon setOffsetX(double offsetX) { 290 | this.offsetX = offsetX; 291 | return this; 292 | } 293 | 294 | public Double getOffsetX() { 295 | return offsetX; 296 | } 297 | 298 | /** 299 | * @param offsetY Defines vertical distance from mouse pointer to balloon pointer. If you set it to 300 | * a small value, the balloon might flicker, as mouse might lose focus on hovered object. 301 | * NOTE: this setting is ignored unless fixedPosition is set to false or Chart Cursor 302 | * is enabled. 303 | * @return AmBalloon 304 | */ 305 | public AmBalloon setOffsetY(double offsetY) { 306 | this.offsetY = offsetY; 307 | return this; 308 | } 309 | 310 | public Double getOffsetY() { 311 | return offsetY; 312 | } 313 | 314 | /** 315 | * @param pointerOrientation Works only if balloon.drop set to true, specifies direction of a pointer. 316 | * @return AmBalloon 317 | */ 318 | public AmBalloon setPointerOrientation(String pointerOrientation) { 319 | this.pointerOrientation = pointerOrientation; 320 | return this; 321 | } 322 | 323 | public String getPointerOrientation() { 324 | return pointerOrientation; 325 | } 326 | 327 | /** 328 | * @param pointerWidth The width of the pointer (arrow) "root". Only used if cornerRadius is 0. 329 | * @return AmBalloon 330 | */ 331 | public AmBalloon setPointerWidth(double pointerWidth) { 332 | this.pointerWidth = pointerWidth; 333 | return this; 334 | } 335 | 336 | public Double getPointerWidth() { 337 | return pointerWidth; 338 | } 339 | 340 | /** 341 | * @param shadowAlpha Opacity of a shadow. 342 | * @return AmBalloon 343 | */ 344 | public AmBalloon setShadowAlpha(double shadowAlpha) { 345 | this.shadowAlpha = shadowAlpha; 346 | return this; 347 | } 348 | 349 | public Double getShadowAlpha() { 350 | return shadowAlpha; 351 | } 352 | 353 | /** 354 | * @param shadowColor Color of a shadow. 355 | * @return AmBalloon 356 | */ 357 | public AmBalloon setShadowColor(Color shadowColor) { 358 | this.shadowColor = shadowColor; 359 | return this; 360 | } 361 | 362 | public Color getShadowColor() { 363 | return shadowColor; 364 | } 365 | 366 | /** 367 | * @param showBullet If cornerRadius of a balloon is >0, showBullet is set to true for value balloons 368 | * when ChartCursor is used. If you don't want the bullet near the balloon, set it to 369 | * false: chart.balloon.showBullet = false 370 | * @return AmBalloon 371 | */ 372 | public AmBalloon setShowBullet(boolean showBullet) { 373 | this.showBullet = showBullet; 374 | return this; 375 | } 376 | 377 | public Boolean getShowBullet() { 378 | return showBullet; 379 | } 380 | 381 | /** 382 | * @param textAlign Text alignment, possible values "left", "middle" and "right" 383 | * @return AmBalloon 384 | */ 385 | public AmBalloon setTextAlign(String textAlign) { 386 | this.textAlign = textAlign; 387 | return this; 388 | } 389 | 390 | public String getTextAlign() { 391 | return textAlign; 392 | } 393 | 394 | /** 395 | * @param verticalPadding Vertical padding of the balloon. 396 | * @return AmBalloon 397 | */ 398 | public AmBalloon setVerticalPadding(double verticalPadding) { 399 | this.verticalPadding = verticalPadding; 400 | return this; 401 | } 402 | 403 | public Double getVerticalPadding() { 404 | return verticalPadding; 405 | } 406 | 407 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/AmRectangularChart.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Extension for AmCoordinateChart and base class of AmSerialChart and AmXYChart. It 9 | * can not be instantiated explicitly. 10 | */ 11 | 12 | public class AmRectangularChart extends AmCoordinateChart { 13 | private Double angle; 14 | private Double autoMarginOffset; 15 | private Boolean autoMargins; 16 | private ChartCursor chartCursor; 17 | private ChartScrollbar chartScrollbar; 18 | private Double depth3D; 19 | private Double marginBottom; 20 | private Double marginLeft; 21 | private Double marginRight; 22 | private Boolean marginsUpdated; 23 | private Double marginTop; 24 | private Double maxZoomFactor; 25 | private Double minMarginBottom; 26 | private Double minMarginLeft; 27 | private Double minMarginRight; 28 | private Double minMarginTop; 29 | private Double plotAreaBorderAlpha; 30 | private Color plotAreaBorderColor; 31 | private Double plotAreaFillAlphas; 32 | private Color plotAreaFillColors; 33 | private Double plotAreaGradientAngle; 34 | private List trendLines; 35 | private Double zoomOutButtonAlpha; 36 | private Color zoomOutButtonColor; 37 | private String zoomOutButtonImage; 38 | private Double zoomOutButtonImageSize; 39 | private Double zoomOutButtonPadding; 40 | private Double zoomOutButtonRollOverAlpha; 41 | private Double zoomOutButtonTabIndex; 42 | private String zoomOutText; 43 | 44 | /** 45 | * @param angle The angle of the 3D part of plot area. This creates a 3D effect (if the "depth3D" 46 | * is > 0). 47 | * @return AmRectangularChart 48 | */ 49 | public AmRectangularChart setAngle(double angle) { 50 | this.angle = angle; 51 | return this; 52 | } 53 | 54 | public Double getAngle() { 55 | return angle; 56 | } 57 | 58 | /** 59 | * @param autoMarginOffset Space left from axis labels/title to the chart's outside border, if autoMargins set 60 | * to true. 61 | * @return AmRectangularChart 62 | */ 63 | public AmRectangularChart setAutoMarginOffset(double autoMarginOffset) { 64 | this.autoMarginOffset = autoMarginOffset; 65 | return this; 66 | } 67 | 68 | public Double getAutoMarginOffset() { 69 | return autoMarginOffset; 70 | } 71 | 72 | /** 73 | * @param autoMargins Specifies if margins of a chart should be calculated automatically so that labels 74 | * of axes would fit. The chart will adjust only margins with axes. Other margins will 75 | * use values set with marginRight, marginTop, marginLeft and marginBottom properties. 76 | * @return AmRectangularChart 77 | */ 78 | public AmRectangularChart setAutoMargins(boolean autoMargins) { 79 | this.autoMargins = autoMargins; 80 | return this; 81 | } 82 | 83 | public Boolean getAutoMargins() { 84 | return autoMargins; 85 | } 86 | 87 | /** 88 | * @param chartCursor Cursor of a chart. 89 | * @return AmRectangularChart 90 | */ 91 | public AmRectangularChart setChartCursor(ChartCursor chartCursor) { 92 | this.chartCursor = chartCursor; 93 | return this; 94 | } 95 | 96 | public ChartCursor getChartCursor() { 97 | return chartCursor; 98 | } 99 | 100 | /** 101 | * @param chartScrollbar Chart's scrollbar. 102 | * @return AmRectangularChart 103 | */ 104 | public AmRectangularChart setChartScrollbar(ChartScrollbar chartScrollbar) { 105 | this.chartScrollbar = chartScrollbar; 106 | return this; 107 | } 108 | 109 | public ChartScrollbar getChartScrollbar() { 110 | return chartScrollbar; 111 | } 112 | 113 | /** 114 | * @param depth3D The depth of the 3D part of plot area. This creates a 3D effect (if the "angle" is 115 | * > 0). 116 | * @return AmRectangularChart 117 | */ 118 | public AmRectangularChart setDepth3D(double depth3D) { 119 | this.depth3D = depth3D; 120 | return this; 121 | } 122 | 123 | public Double getDepth3D() { 124 | return depth3D; 125 | } 126 | 127 | /** 128 | * @param marginBottom Number of pixels between the container's bottom border and plot area. This space 129 | * can be used for bottom axis' values. If autoMargin is true and bottom side has axis, 130 | * this property is ignored. 131 | * @return AmRectangularChart 132 | */ 133 | public AmRectangularChart setMarginBottom(double marginBottom) { 134 | this.marginBottom = marginBottom; 135 | return this; 136 | } 137 | 138 | public Double getMarginBottom() { 139 | return marginBottom; 140 | } 141 | 142 | /** 143 | * @param marginLeft Number of pixels between the container's left border and plot area. This space can 144 | * be used for left axis' values. If autoMargin is true and left side has axis, this 145 | * property is ignored. 146 | * @return AmRectangularChart 147 | */ 148 | public AmRectangularChart setMarginLeft(double marginLeft) { 149 | this.marginLeft = marginLeft; 150 | return this; 151 | } 152 | 153 | public Double getMarginLeft() { 154 | return marginLeft; 155 | } 156 | 157 | /** 158 | * @param marginRight Number of pixels between the container's right border and plot area. This space can 159 | * be used for Right axis' values. If autoMargin is true and right side has axis, this 160 | * property is ignored. 161 | * @return AmRectangularChart 162 | */ 163 | public AmRectangularChart setMarginRight(double marginRight) { 164 | this.marginRight = marginRight; 165 | return this; 166 | } 167 | 168 | public Double getMarginRight() { 169 | return marginRight; 170 | } 171 | 172 | /** 173 | * @param marginsUpdated Flag which should be set to false if you need margins to be recalculated on next 174 | * chart.validateNow() call. 175 | * @return AmRectangularChart 176 | */ 177 | public AmRectangularChart setMarginsUpdated(boolean marginsUpdated) { 178 | this.marginsUpdated = marginsUpdated; 179 | return this; 180 | } 181 | 182 | public Boolean getMarginsUpdated() { 183 | return marginsUpdated; 184 | } 185 | 186 | /** 187 | * @param marginTop Number of pixels between the container's top border and plot area. This space can 188 | * be used for top axis' values. If autoMargin is true and top side has axis, this property 189 | * is ignored. 190 | * @return AmRectangularChart 191 | */ 192 | public AmRectangularChart setMarginTop(double marginTop) { 193 | this.marginTop = marginTop; 194 | return this; 195 | } 196 | 197 | public Double getMarginTop() { 198 | return marginTop; 199 | } 200 | 201 | /** 202 | * @param maxZoomFactor Maximum zoom factor value axes. 203 | * @return AmRectangularChart 204 | */ 205 | public AmRectangularChart setMaxZoomFactor(double maxZoomFactor) { 206 | this.maxZoomFactor = maxZoomFactor; 207 | return this; 208 | } 209 | 210 | public Double getMaxZoomFactor() { 211 | return maxZoomFactor; 212 | } 213 | 214 | /** 215 | * @param minMarginBottom If bottom side has a value axis and autoMargins is set to true (default), the margin 216 | * of this side will be not less than set on minMarginBottom property. 217 | * @return AmRectangularChart 218 | */ 219 | public AmRectangularChart setMinMarginBottom(double minMarginBottom) { 220 | this.minMarginBottom = minMarginBottom; 221 | return this; 222 | } 223 | 224 | public Double getMinMarginBottom() { 225 | return minMarginBottom; 226 | } 227 | 228 | /** 229 | * @param minMarginLeft If left side has a value axis and autoMargins is set to true (default), the margin 230 | * of this side will be not less than set on minMarginLeft property. 231 | * @return AmRectangularChart 232 | */ 233 | public AmRectangularChart setMinMarginLeft(double minMarginLeft) { 234 | this.minMarginLeft = minMarginLeft; 235 | return this; 236 | } 237 | 238 | public Double getMinMarginLeft() { 239 | return minMarginLeft; 240 | } 241 | 242 | /** 243 | * @param minMarginRight If right side has a value axis and autoMargins is set to true (default), the margin 244 | * of this side will be not less than set on minMarginRight property. 245 | * @return AmRectangularChart 246 | */ 247 | public AmRectangularChart setMinMarginRight(double minMarginRight) { 248 | this.minMarginRight = minMarginRight; 249 | return this; 250 | } 251 | 252 | public Double getMinMarginRight() { 253 | return minMarginRight; 254 | } 255 | 256 | /** 257 | * @param minMarginTop If top side has a value axis and autoMargins is set to true (default), the margin 258 | * of this side will be not less than set on minMarginTop property. 259 | * @return AmRectangularChart 260 | */ 261 | public AmRectangularChart setMinMarginTop(double minMarginTop) { 262 | this.minMarginTop = minMarginTop; 263 | return this; 264 | } 265 | 266 | public Double getMinMarginTop() { 267 | return minMarginTop; 268 | } 269 | 270 | /** 271 | * @param plotAreaBorderAlpha The opacity of plot area's border. Value range is 0 - 1. 272 | * @return AmRectangularChart 273 | */ 274 | public AmRectangularChart setPlotAreaBorderAlpha(double plotAreaBorderAlpha) { 275 | this.plotAreaBorderAlpha = plotAreaBorderAlpha; 276 | return this; 277 | } 278 | 279 | public Double getPlotAreaBorderAlpha() { 280 | return plotAreaBorderAlpha; 281 | } 282 | 283 | /** 284 | * @param plotAreaBorderColor The color of the plot area's border. Note, the it is invisible by default, as plotAreaBorderAlpha 285 | * default value is 0. Set it to a value higher than 0 to make it visible. 286 | * @return AmRectangularChart 287 | */ 288 | public AmRectangularChart setPlotAreaBorderColor(Color plotAreaBorderColor) { 289 | this.plotAreaBorderColor = plotAreaBorderColor; 290 | return this; 291 | } 292 | 293 | public Color getPlotAreaBorderColor() { 294 | return plotAreaBorderColor; 295 | } 296 | 297 | /** 298 | * @param plotAreaFillAlphas Opacity of plot area. Plural form is used to keep the same property names as our 299 | * Flex charts'. Flex charts can accept array of numbers to generate gradients. Although 300 | * you can set array here, only first value of this array will be used. 301 | * @return AmRectangularChart 302 | */ 303 | public AmRectangularChart setPlotAreaFillAlphas(double plotAreaFillAlphas) { 304 | this.plotAreaFillAlphas = plotAreaFillAlphas; 305 | return this; 306 | } 307 | 308 | public Double getPlotAreaFillAlphas() { 309 | return plotAreaFillAlphas; 310 | } 311 | 312 | /** 313 | * @param plotAreaFillColors You can set both one color if you need a solid color or array of colors to generate 314 | * gradients, for example: ["#000000", "#0000CC"] 315 | * @return AmRectangularChart 316 | */ 317 | public AmRectangularChart setPlotAreaFillColors(Color plotAreaFillColors) { 318 | this.plotAreaFillColors = plotAreaFillColors; 319 | return this; 320 | } 321 | 322 | public Color getPlotAreaFillColors() { 323 | return plotAreaFillColors; 324 | } 325 | 326 | /** 327 | * @param plotAreaGradientAngle If you are using gradients to fill the plot area, you can use this property to set 328 | * gradient angle. The only allowed values are horizontal and vertical: 0, 90, 180, 329 | * 270. 330 | * @return AmRectangularChart 331 | */ 332 | public AmRectangularChart setPlotAreaGradientAngle(double plotAreaGradientAngle) { 333 | this.plotAreaGradientAngle = plotAreaGradientAngle; 334 | return this; 335 | } 336 | 337 | public Double getPlotAreaGradientAngle() { 338 | return plotAreaGradientAngle; 339 | } 340 | 341 | /** 342 | * @param trendLines Array of trend lines added to a chart. You can add trend lines to a chart using this 343 | * array or access already existing trend lines 344 | * @return AmRectangularChart 345 | */ 346 | public AmRectangularChart setTrendLines(List trendLines) { 347 | this.trendLines = trendLines; 348 | return this; 349 | } 350 | 351 | public List getTrendLines() { 352 | return trendLines; 353 | } 354 | 355 | /** 356 | * @param zoomOutButtonAlpha Opacity of zoom-out button background. 357 | * @return AmRectangularChart 358 | */ 359 | public AmRectangularChart setZoomOutButtonAlpha(double zoomOutButtonAlpha) { 360 | this.zoomOutButtonAlpha = zoomOutButtonAlpha; 361 | return this; 362 | } 363 | 364 | public Double getZoomOutButtonAlpha() { 365 | return zoomOutButtonAlpha; 366 | } 367 | 368 | /** 369 | * @param zoomOutButtonColor Zoom-out button background color. 370 | * @return AmRectangularChart 371 | */ 372 | public AmRectangularChart setZoomOutButtonColor(Color zoomOutButtonColor) { 373 | this.zoomOutButtonColor = zoomOutButtonColor; 374 | return this; 375 | } 376 | 377 | public Color getZoomOutButtonColor() { 378 | return zoomOutButtonColor; 379 | } 380 | 381 | /** 382 | * @param zoomOutButtonImage Name of zoom-out button image. In the images folder there is another lens image, 383 | * called lensWhite.png. You might want to have white lens when background is dark. 384 | * Or you can simply use your own image. Note, you don't have to set image extension. 385 | * If svgIcons is set to true (default) .svg will be added to the file name if SVG is 386 | * supported by the browser, otherwise – .png. 387 | * @return AmRectangularChart 388 | */ 389 | public AmRectangularChart setZoomOutButtonImage(String zoomOutButtonImage) { 390 | this.zoomOutButtonImage = zoomOutButtonImage; 391 | return this; 392 | } 393 | 394 | public String getZoomOutButtonImage() { 395 | return zoomOutButtonImage; 396 | } 397 | 398 | /** 399 | * @param zoomOutButtonImageSize Size of zoom-out button image 400 | * @return AmRectangularChart 401 | */ 402 | public AmRectangularChart setZoomOutButtonImageSize(double zoomOutButtonImageSize) { 403 | this.zoomOutButtonImageSize = zoomOutButtonImageSize; 404 | return this; 405 | } 406 | 407 | public Double getZoomOutButtonImageSize() { 408 | return zoomOutButtonImageSize; 409 | } 410 | 411 | /** 412 | * @param zoomOutButtonPadding Padding around the text and image. 413 | * @return AmRectangularChart 414 | */ 415 | public AmRectangularChart setZoomOutButtonPadding(double zoomOutButtonPadding) { 416 | this.zoomOutButtonPadding = zoomOutButtonPadding; 417 | return this; 418 | } 419 | 420 | public Double getZoomOutButtonPadding() { 421 | return zoomOutButtonPadding; 422 | } 423 | 424 | /** 425 | * @param zoomOutButtonRollOverAlpha Opacity of zoom-out button background when mouse is over it. 426 | * @return AmRectangularChart 427 | */ 428 | public AmRectangularChart setZoomOutButtonRollOverAlpha(double zoomOutButtonRollOverAlpha) { 429 | this.zoomOutButtonRollOverAlpha = zoomOutButtonRollOverAlpha; 430 | return this; 431 | } 432 | 433 | public Double getZoomOutButtonRollOverAlpha() { 434 | return zoomOutButtonRollOverAlpha; 435 | } 436 | 437 | /** 438 | * @param zoomOutButtonTabIndex In case you set it to some number, the chart will set focus on zoom-out button when 439 | * user clicks tab key. When a focus is set, screen readers like NVDA Screen reader 440 | * will read zoomOutText. If user clicks Enter when a focus is set, the chart will zoom-out. 441 | * Note, not all browsers and readers support this. 442 | * @return AmRectangularChart 443 | */ 444 | public AmRectangularChart setZoomOutButtonTabIndex(double zoomOutButtonTabIndex) { 445 | this.zoomOutButtonTabIndex = zoomOutButtonTabIndex; 446 | return this; 447 | } 448 | 449 | public Double getZoomOutButtonTabIndex() { 450 | return zoomOutButtonTabIndex; 451 | } 452 | 453 | /** 454 | * @param zoomOutText Text in the zoom-out button. 455 | * @return AmRectangularChart 456 | */ 457 | public AmRectangularChart setZoomOutText(String zoomOutText) { 458 | this.zoomOutText = zoomOutText; 459 | return this; 460 | } 461 | 462 | public String getZoomOutText() { 463 | return zoomOutText; 464 | } 465 | 466 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/ChartCursor.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | /** 9 | * Creates a cursor for the chart which follows the mouse movements. In case of AmSerialChart 10 | * charts it shows the balloons of hovered data points. 11 | */ 12 | 13 | public class ChartCursor implements Serializable { 14 | private Double adjustment; 15 | private Double animationDuration; 16 | private Boolean avoidBalloonOverlapping; 17 | private String balloonPointerOrientation; 18 | private Boolean bulletsEnabled; 19 | private Double bulletSize; 20 | private Double categoryBalloonAlpha; 21 | private Color categoryBalloonColor; 22 | private String categoryBalloonDateFormat; 23 | private Boolean categoryBalloonEnabled; 24 | private String categoryBalloonText; 25 | private Color color; 26 | private Double cursorAlpha; 27 | private Color cursorColor; 28 | private String cursorPosition; 29 | private Boolean enabled; 30 | private Boolean fullWidth; 31 | private Double graphBulletAlpha; 32 | private Double graphBulletSize; 33 | private Boolean leaveAfterTouch; 34 | private Boolean leaveCursor; 35 | private AmGraph limitToGraph; 36 | private List listeners; 37 | private Boolean oneBalloonOnly; 38 | private Boolean pan; 39 | private Double selectionAlpha; 40 | private Boolean selectWithoutZooming; 41 | private Boolean showNextAvailable; 42 | private Double tabIndex; 43 | private Boolean valueBalloonsEnabled; 44 | private Double valueLineAlpha; 45 | private Boolean valueLineBalloonEnabled; 46 | private Boolean valueLineEnabled; 47 | private Boolean valueZoomable; 48 | private Boolean zoomable; 49 | private Boolean zooming; 50 | 51 | /** 52 | * @param adjustment If you set adjustment to -1, the balloon will be shown near previous, if you set 53 | * it to 1 - near next data point. 54 | * @return ChartCursor 55 | */ 56 | public ChartCursor setAdjustment(double adjustment) { 57 | this.adjustment = adjustment; 58 | return this; 59 | } 60 | 61 | public Double getAdjustment() { 62 | return adjustment; 63 | } 64 | 65 | /** 66 | * @param animationDuration Duration of animation of a line, in seconds. 67 | * @return ChartCursor 68 | */ 69 | public ChartCursor setAnimationDuration(double animationDuration) { 70 | this.animationDuration = animationDuration; 71 | return this; 72 | } 73 | 74 | public Double getAnimationDuration() { 75 | return animationDuration; 76 | } 77 | 78 | /** 79 | * @param avoidBalloonOverlapping Specifies if cursor should arrange balloons so they won't overlap. If chart is rotated, 80 | * it might be good idea to turn this off. 81 | * @return ChartCursor 82 | */ 83 | public ChartCursor setAvoidBalloonOverlapping(boolean avoidBalloonOverlapping) { 84 | this.avoidBalloonOverlapping = avoidBalloonOverlapping; 85 | return this; 86 | } 87 | 88 | public Boolean getAvoidBalloonOverlapping() { 89 | return avoidBalloonOverlapping; 90 | } 91 | 92 | /** 93 | * @param balloonPointerOrientation defines if the balloon should be shown above the datapoint or sideways 94 | * @return ChartCursor 95 | */ 96 | public ChartCursor setBalloonPointerOrientation(String balloonPointerOrientation) { 97 | this.balloonPointerOrientation = balloonPointerOrientation; 98 | return this; 99 | } 100 | 101 | public String getBalloonPointerOrientation() { 102 | return balloonPointerOrientation; 103 | } 104 | 105 | /** 106 | * @param bulletsEnabled Specifies if bullet for each graph will follow the cursor. 107 | * @return ChartCursor 108 | */ 109 | public ChartCursor setBulletsEnabled(boolean bulletsEnabled) { 110 | this.bulletsEnabled = bulletsEnabled; 111 | return this; 112 | } 113 | 114 | public Boolean getBulletsEnabled() { 115 | return bulletsEnabled; 116 | } 117 | 118 | /** 119 | * @param bulletSize Size of bullets, following the cursor. 120 | * @return ChartCursor 121 | */ 122 | public ChartCursor setBulletSize(double bulletSize) { 123 | this.bulletSize = bulletSize; 124 | return this; 125 | } 126 | 127 | public Double getBulletSize() { 128 | return bulletSize; 129 | } 130 | 131 | /** 132 | * @param categoryBalloonAlpha Opacity of the category balloon. 133 | * @return ChartCursor 134 | */ 135 | public ChartCursor setCategoryBalloonAlpha(double categoryBalloonAlpha) { 136 | this.categoryBalloonAlpha = categoryBalloonAlpha; 137 | return this; 138 | } 139 | 140 | public Double getCategoryBalloonAlpha() { 141 | return categoryBalloonAlpha; 142 | } 143 | 144 | /** 145 | * @param categoryBalloonColor Color of the category balloon. cursorColor is used if not set. 146 | * @return ChartCursor 147 | */ 148 | public ChartCursor setCategoryBalloonColor(Color categoryBalloonColor) { 149 | this.categoryBalloonColor = categoryBalloonColor; 150 | return this; 151 | } 152 | 153 | public Color getCategoryBalloonColor() { 154 | return categoryBalloonColor; 155 | } 156 | 157 | /** 158 | * @param categoryBalloonDateFormat Category balloon date format (used only if category axis parses dates). Check this 159 | * page for instructions on how to format dates. 160 | * @return ChartCursor 161 | */ 162 | public ChartCursor setCategoryBalloonDateFormat(String categoryBalloonDateFormat) { 163 | this.categoryBalloonDateFormat = categoryBalloonDateFormat; 164 | return this; 165 | } 166 | 167 | public String getCategoryBalloonDateFormat() { 168 | return categoryBalloonDateFormat; 169 | } 170 | 171 | /** 172 | * @param categoryBalloonEnabled Specifies whether category balloon is enabled. 173 | * @return ChartCursor 174 | */ 175 | public ChartCursor setCategoryBalloonEnabled(boolean categoryBalloonEnabled) { 176 | this.categoryBalloonEnabled = categoryBalloonEnabled; 177 | return this; 178 | } 179 | 180 | public Boolean getCategoryBalloonEnabled() { 181 | return categoryBalloonEnabled; 182 | } 183 | 184 | /** 185 | * @param categoryBalloonText You can have [[category]] - [[toCategory]] tags in there and show category ranges 186 | * this way. 187 | * @return ChartCursor 188 | */ 189 | public ChartCursor setCategoryBalloonText(String categoryBalloonText) { 190 | this.categoryBalloonText = categoryBalloonText; 191 | return this; 192 | } 193 | 194 | public String getCategoryBalloonText() { 195 | return categoryBalloonText; 196 | } 197 | 198 | /** 199 | * @param color Text color. 200 | * @return ChartCursor 201 | */ 202 | public ChartCursor setColor(Color color) { 203 | this.color = color; 204 | return this; 205 | } 206 | 207 | public Color getColor() { 208 | return color; 209 | } 210 | 211 | /** 212 | * @param cursorAlpha Opacity of the cursor line. 213 | * @return ChartCursor 214 | */ 215 | public ChartCursor setCursorAlpha(double cursorAlpha) { 216 | this.cursorAlpha = cursorAlpha; 217 | return this; 218 | } 219 | 220 | public Double getCursorAlpha() { 221 | return cursorAlpha; 222 | } 223 | 224 | /** 225 | * @param cursorColor Color of the cursor line. 226 | * @return ChartCursor 227 | */ 228 | public ChartCursor setCursorColor(Color cursorColor) { 229 | this.cursorColor = cursorColor; 230 | return this; 231 | } 232 | 233 | public Color getCursorColor() { 234 | return cursorColor; 235 | } 236 | 237 | /** 238 | * @param cursorPosition Specifies where the cursor line should be placed - on the beginning of the period 239 | * (day, hour, etc) or in the middle (only when parseDates property of categoryAxis 240 | * is set to true). If you want the cursor to follow mouse and not to glue to the nearest 241 | * data point, set "mouse" here. Possible values are: start, middle, mouse. 242 | * @return ChartCursor 243 | */ 244 | public ChartCursor setCursorPosition(String cursorPosition) { 245 | this.cursorPosition = cursorPosition; 246 | return this; 247 | } 248 | 249 | public String getCursorPosition() { 250 | return cursorPosition; 251 | } 252 | 253 | /** 254 | * @param enabled Specifies whether cursor is enabled. 255 | * @return ChartCursor 256 | */ 257 | public ChartCursor setEnabled(boolean enabled) { 258 | this.enabled = enabled; 259 | return this; 260 | } 261 | 262 | public Boolean getEnabled() { 263 | return enabled; 264 | } 265 | 266 | /** 267 | * @param fullWidth If set to true, instead of a cursor line user will see a fill which width will always 268 | * be equal to the width of one data item. We'd recommend setting cursorAlpha to 0.1 269 | * or some other small number if using this feature. 270 | * @return ChartCursor 271 | */ 272 | public ChartCursor setFullWidth(boolean fullWidth) { 273 | this.fullWidth = fullWidth; 274 | return this; 275 | } 276 | 277 | public Boolean getFullWidth() { 278 | return fullWidth; 279 | } 280 | 281 | /** 282 | * @param graphBulletAlpha If you make graph's bullets invisible by setting their opacity to 0 and will set 283 | * graphBulletAlpha to 1, the bullets will only appear at the cursor's position. 284 | * @return ChartCursor 285 | */ 286 | public ChartCursor setGraphBulletAlpha(double graphBulletAlpha) { 287 | this.graphBulletAlpha = graphBulletAlpha; 288 | return this; 289 | } 290 | 291 | public Double getGraphBulletAlpha() { 292 | return graphBulletAlpha; 293 | } 294 | 295 | /** 296 | * @param graphBulletSize Size of a graph's bullet (if available) at the cursor position. If you don't want 297 | * the bullet to change it's size, set this property to 1. 298 | * @return ChartCursor 299 | */ 300 | public ChartCursor setGraphBulletSize(double graphBulletSize) { 301 | this.graphBulletSize = graphBulletSize; 302 | return this; 303 | } 304 | 305 | public Double getGraphBulletSize() { 306 | return graphBulletSize; 307 | } 308 | 309 | /** 310 | * @param leaveAfterTouch This makes cursor and balloons to remain after user touches the chart. 311 | * @return ChartCursor 312 | */ 313 | public ChartCursor setLeaveAfterTouch(boolean leaveAfterTouch) { 314 | this.leaveAfterTouch = leaveAfterTouch; 315 | return this; 316 | } 317 | 318 | public Boolean getLeaveAfterTouch() { 319 | return leaveAfterTouch; 320 | } 321 | 322 | /** 323 | * @param leaveCursor Specifies if cursor should be left at it's last position. Useful for touch devices 324 | * - user might want to see the balloons after he moves finger away. 325 | * @return ChartCursor 326 | */ 327 | public ChartCursor setLeaveCursor(boolean leaveCursor) { 328 | this.leaveCursor = leaveCursor; 329 | return this; 330 | } 331 | 332 | public Boolean getLeaveCursor() { 333 | return leaveCursor; 334 | } 335 | 336 | /** 337 | * @param limitToGraph If set to an id or a reference to AmGraph object, CategoryAxis cursor line will be 338 | * limited to this graph instead of being drawn through full height of plot area. Note, 339 | * this works with serial chart only. Also, cursorPosition of ChartCursor must be set 340 | * to middle. 341 | * @return ChartCursor 342 | */ 343 | public ChartCursor setLimitToGraph(AmGraph limitToGraph) { 344 | this.limitToGraph = limitToGraph; 345 | return this; 346 | } 347 | 348 | public AmGraph getLimitToGraph() { 349 | return limitToGraph; 350 | } 351 | 352 | /** 353 | * @param listeners You can add listeners of events using this property. Example: listeners = [{"event":"changed", 354 | * "method":handleEvent}]; 355 | * @return ChartCursor 356 | */ 357 | public ChartCursor setListeners(List listeners) { 358 | this.listeners = listeners; 359 | return this; 360 | } 361 | 362 | public List getListeners() { 363 | return listeners; 364 | } 365 | 366 | /** 367 | * @param oneBalloonOnly If this is set to true, only one balloon at a time will be displayed. Note, this 368 | * is quite CPU consuming. 369 | * @return ChartCursor 370 | */ 371 | public ChartCursor setOneBalloonOnly(boolean oneBalloonOnly) { 372 | this.oneBalloonOnly = oneBalloonOnly; 373 | return this; 374 | } 375 | 376 | public Boolean getOneBalloonOnly() { 377 | return oneBalloonOnly; 378 | } 379 | 380 | /** 381 | * @param pan *If this is set to true, the user will be able to pan the chart instead of zooming. 382 | * @return ChartCursor 383 | */ 384 | public ChartCursor setPan(boolean pan) { 385 | this.pan = pan; 386 | return this; 387 | } 388 | 389 | public Boolean getPan() { 390 | return pan; 391 | } 392 | 393 | /** 394 | * @param selectionAlpha Opacity of the selection. 395 | * @return ChartCursor 396 | */ 397 | public ChartCursor setSelectionAlpha(double selectionAlpha) { 398 | this.selectionAlpha = selectionAlpha; 399 | return this; 400 | } 401 | 402 | public Double getSelectionAlpha() { 403 | return selectionAlpha; 404 | } 405 | 406 | /** 407 | * @param selectWithoutZooming Specifies if cursor should only mark selected area but not zoom-in after user releases 408 | * mouse button. 409 | * @return ChartCursor 410 | */ 411 | public ChartCursor setSelectWithoutZooming(boolean selectWithoutZooming) { 412 | this.selectWithoutZooming = selectWithoutZooming; 413 | return this; 414 | } 415 | 416 | public Boolean getSelectWithoutZooming() { 417 | return selectWithoutZooming; 418 | } 419 | 420 | /** 421 | * @param showNextAvailable If true, the graph will display balloon on next available data point if currently 422 | * hovered item doesn't have value for this graph. 423 | * @return ChartCursor 424 | */ 425 | public ChartCursor setShowNextAvailable(boolean showNextAvailable) { 426 | this.showNextAvailable = showNextAvailable; 427 | return this; 428 | } 429 | 430 | public Boolean getShowNextAvailable() { 431 | return showNextAvailable; 432 | } 433 | 434 | /** 435 | * @param tabIndex In case you set it to some number, the chart will set focus on chart cursor (works 436 | * only with serial chart) when user clicks tab key. When a focus is set user can move 437 | * cursor using cursor keys. Note, not all browsers and readers support this. 438 | * @return ChartCursor 439 | */ 440 | public ChartCursor setTabIndex(double tabIndex) { 441 | this.tabIndex = tabIndex; 442 | return this; 443 | } 444 | 445 | public Double getTabIndex() { 446 | return tabIndex; 447 | } 448 | 449 | /** 450 | * @param valueBalloonsEnabled Specifies whether value balloons are enabled. In case they are not, the balloons 451 | * might be displayed anyway, when the user rolls-over the column or bullet. 452 | * @return ChartCursor 453 | */ 454 | public ChartCursor setValueBalloonsEnabled(boolean valueBalloonsEnabled) { 455 | this.valueBalloonsEnabled = valueBalloonsEnabled; 456 | return this; 457 | } 458 | 459 | public Boolean getValueBalloonsEnabled() { 460 | return valueBalloonsEnabled; 461 | } 462 | 463 | /** 464 | * @param valueLineAlpha Opacity of value line. Will use cursorAlpha value if not set. 465 | * @return ChartCursor 466 | */ 467 | public ChartCursor setValueLineAlpha(double valueLineAlpha) { 468 | this.valueLineAlpha = valueLineAlpha; 469 | return this; 470 | } 471 | 472 | public Double getValueLineAlpha() { 473 | return valueLineAlpha; 474 | } 475 | 476 | /** 477 | * @param valueLineBalloonEnabled Specifies if value balloon next to value axes labels should be displayed. 478 | * @return ChartCursor 479 | */ 480 | public ChartCursor setValueLineBalloonEnabled(boolean valueLineBalloonEnabled) { 481 | this.valueLineBalloonEnabled = valueLineBalloonEnabled; 482 | return this; 483 | } 484 | 485 | public Boolean getValueLineBalloonEnabled() { 486 | return valueLineBalloonEnabled; 487 | } 488 | 489 | /** 490 | * @param valueLineEnabled Specifies if cursor of Serial chart should display horizontal (or vertical if chart 491 | * is rotated) line. This line might help users to compare distant values of a chart. 492 | * You can also enable value balloons on this line by setting valueLineBalloonEnabled 493 | * to true. 494 | * @return ChartCursor 495 | */ 496 | public ChartCursor setValueLineEnabled(boolean valueLineEnabled) { 497 | this.valueLineEnabled = valueLineEnabled; 498 | return this; 499 | } 500 | 501 | public Boolean getValueLineEnabled() { 502 | return valueLineEnabled; 503 | } 504 | 505 | /** 506 | * @param valueZoomable Specifies if the user can zoom-in value axess of a serial chart. 507 | * @return ChartCursor 508 | */ 509 | public ChartCursor setValueZoomable(boolean valueZoomable) { 510 | this.valueZoomable = valueZoomable; 511 | return this; 512 | } 513 | 514 | public Boolean getValueZoomable() { 515 | return valueZoomable; 516 | } 517 | 518 | /** 519 | * @param zoomable Specifies if the user can zoom-in the chart. If pan is set to true, zoomable is switched 520 | * to false automatically. 521 | * @return ChartCursor 522 | */ 523 | public ChartCursor setZoomable(boolean zoomable) { 524 | this.zoomable = zoomable; 525 | return this; 526 | } 527 | 528 | public Boolean getZoomable() { 529 | return zoomable; 530 | } 531 | 532 | /** 533 | * @param zooming Read-only. Indicates if currently user is selecting some chart area to zoom-in. 534 | * @return ChartCursor 535 | */ 536 | public ChartCursor setZooming(boolean zooming) { 537 | this.zooming = zooming; 538 | return this; 539 | } 540 | 541 | public Boolean getZooming() { 542 | return zooming; 543 | } 544 | 545 | } -------------------------------------------------------------------------------- /src/main/java/de/stekoe/amcharts/GaugeAxis.java: -------------------------------------------------------------------------------- 1 | package de.stekoe.amcharts; 2 | 3 | import de.stekoe.amcharts.addition.Color; 4 | import de.stekoe.amcharts.addition.Listener; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * Creates an axis for AmAngularGauge charts, multiple can be assigned. 11 | */ 12 | 13 | public class GaugeAxis implements Serializable { 14 | private Double axisAlpha; 15 | private Color axisColor; 16 | private Double axisThickness; 17 | private Double bandAlpha; 18 | private List bandGradientRatio; 19 | private Double bandOutlineAlpha; 20 | private Color bandOutlineColor; 21 | private Double bandOutlineThickness; 22 | private List bands; 23 | private String bottomText; 24 | private Boolean bottomTextBold; 25 | private Color bottomTextColor; 26 | private Double bottomTextFontSize; 27 | private Double bottomTextYOffset; 28 | private String centerX; 29 | private String centerY; 30 | private Color color; 31 | private Double endAngle; 32 | private Double endValue; 33 | private Double fontSize; 34 | private Double gridCount; 35 | private Boolean gridInside; 36 | private String id; 37 | private Boolean inside; 38 | private Double labelFrequency; 39 | private Double labelOffset; 40 | private Boolean labelsEnabled; 41 | private List listeners; 42 | private Double minorTickInterval; 43 | private Double minorTickLength; 44 | private String radius; 45 | private Boolean showFirstLabel; 46 | private Boolean showLastLabel; 47 | private Double startAngle; 48 | private Double startValue; 49 | private Double tickAlpha; 50 | private Color tickColor; 51 | private Double tickLength; 52 | private Double tickThickness; 53 | private String topText; 54 | private Boolean topTextBold; 55 | private Color topTextColor; 56 | private Double topTextFontSize; 57 | private Double topTextYOffset; 58 | private String unit; 59 | private String unitPosition; 60 | private Boolean usePrefixes; 61 | private Double valueInterval; 62 | 63 | /** 64 | * @param axisAlpha Axis opacity. 65 | * @return GaugeAxis 66 | */ 67 | public GaugeAxis setAxisAlpha(double axisAlpha) { 68 | this.axisAlpha = axisAlpha; 69 | return this; 70 | } 71 | 72 | public Double getAxisAlpha() { 73 | return axisAlpha; 74 | } 75 | 76 | /** 77 | * @param axisColor Axis color. 78 | * @return GaugeAxis 79 | */ 80 | public GaugeAxis setAxisColor(Color axisColor) { 81 | this.axisColor = axisColor; 82 | return this; 83 | } 84 | 85 | public Color getAxisColor() { 86 | return axisColor; 87 | } 88 | 89 | /** 90 | * @param axisThickness Thickness of the axis outline. 91 | * @return GaugeAxis 92 | */ 93 | public GaugeAxis setAxisThickness(double axisThickness) { 94 | this.axisThickness = axisThickness; 95 | return this; 96 | } 97 | 98 | public Double getAxisThickness() { 99 | return axisThickness; 100 | } 101 | 102 | /** 103 | * @param bandAlpha Opacity of band fills. 104 | * @return GaugeAxis 105 | */ 106 | public GaugeAxis setBandAlpha(double bandAlpha) { 107 | this.bandAlpha = bandAlpha; 108 | return this; 109 | } 110 | 111 | public Double getBandAlpha() { 112 | return bandAlpha; 113 | } 114 | 115 | /** 116 | * @param bandGradientRatio Example: [-0.2, 0, -0.2]. Will make bands to be filled with color gradients. Negative 117 | * value means the color will be darker than the original, and positive number means 118 | * the color will be lighter. 119 | * @return GaugeAxis 120 | */ 121 | public GaugeAxis setBandGradientRatio(List bandGradientRatio) { 122 | this.bandGradientRatio = bandGradientRatio; 123 | return this; 124 | } 125 | 126 | public List getBandGradientRatio() { 127 | return bandGradientRatio; 128 | } 129 | 130 | /** 131 | * @param bandOutlineAlpha Opacity of band outlines. 132 | * @return GaugeAxis 133 | */ 134 | public GaugeAxis setBandOutlineAlpha(double bandOutlineAlpha) { 135 | this.bandOutlineAlpha = bandOutlineAlpha; 136 | return this; 137 | } 138 | 139 | public Double getBandOutlineAlpha() { 140 | return bandOutlineAlpha; 141 | } 142 | 143 | /** 144 | * @param bandOutlineColor Color of band outlines. 145 | * @return GaugeAxis 146 | */ 147 | public GaugeAxis setBandOutlineColor(Color bandOutlineColor) { 148 | this.bandOutlineColor = bandOutlineColor; 149 | return this; 150 | } 151 | 152 | public Color getBandOutlineColor() { 153 | return bandOutlineColor; 154 | } 155 | 156 | /** 157 | * @param bandOutlineThickness Thickness of band outlines. 158 | * @return GaugeAxis 159 | */ 160 | public GaugeAxis setBandOutlineThickness(double bandOutlineThickness) { 161 | this.bandOutlineThickness = bandOutlineThickness; 162 | return this; 163 | } 164 | 165 | public Double getBandOutlineThickness() { 166 | return bandOutlineThickness; 167 | } 168 | 169 | /** 170 | * @param bands Array of bands - GaugeBand objects. Bands are used to draw color fills between specified 171 | * values. 172 | * @return GaugeAxis 173 | */ 174 | public GaugeAxis setBands(List bands) { 175 | this.bands = bands; 176 | return this; 177 | } 178 | 179 | public List getBands() { 180 | return bands; 181 | } 182 | 183 | /** 184 | * @param bottomText Text displayed below the axis center. 185 | * @return GaugeAxis 186 | */ 187 | public GaugeAxis setBottomText(String bottomText) { 188 | this.bottomText = bottomText; 189 | return this; 190 | } 191 | 192 | public String getBottomText() { 193 | return bottomText; 194 | } 195 | 196 | /** 197 | * @param bottomTextBold Specifies if text should be bold. 198 | * @return GaugeAxis 199 | */ 200 | public GaugeAxis setBottomTextBold(boolean bottomTextBold) { 201 | this.bottomTextBold = bottomTextBold; 202 | return this; 203 | } 204 | 205 | public Boolean getBottomTextBold() { 206 | return bottomTextBold; 207 | } 208 | 209 | /** 210 | * @param bottomTextColor Bottom text color. 211 | * @return GaugeAxis 212 | */ 213 | public GaugeAxis setBottomTextColor(Color bottomTextColor) { 214 | this.bottomTextColor = bottomTextColor; 215 | return this; 216 | } 217 | 218 | public Color getBottomTextColor() { 219 | return bottomTextColor; 220 | } 221 | 222 | /** 223 | * @param bottomTextFontSize Font size of bottom text. 224 | * @return GaugeAxis 225 | */ 226 | public GaugeAxis setBottomTextFontSize(double bottomTextFontSize) { 227 | this.bottomTextFontSize = bottomTextFontSize; 228 | return this; 229 | } 230 | 231 | public Double getBottomTextFontSize() { 232 | return bottomTextFontSize; 233 | } 234 | 235 | /** 236 | * @param bottomTextYOffset Y offset of bottom text. 237 | * @return GaugeAxis 238 | */ 239 | public GaugeAxis setBottomTextYOffset(double bottomTextYOffset) { 240 | this.bottomTextYOffset = bottomTextYOffset; 241 | return this; 242 | } 243 | 244 | public Double getBottomTextYOffset() { 245 | return bottomTextYOffset; 246 | } 247 | 248 | /** 249 | * @param centerX X position of the axis, relative to the center of the gauge. 250 | * @return GaugeAxis 251 | */ 252 | public GaugeAxis setCenterX(String centerX) { 253 | this.centerX = centerX; 254 | return this; 255 | } 256 | 257 | public String getCenterX() { 258 | return centerX; 259 | } 260 | 261 | /** 262 | * @param centerY Y position of the axis, relative to the center of the gauge. 263 | * @return GaugeAxis 264 | */ 265 | public GaugeAxis setCenterY(String centerY) { 266 | this.centerY = centerY; 267 | return this; 268 | } 269 | 270 | public String getCenterY() { 271 | return centerY; 272 | } 273 | 274 | /** 275 | * @param color Specifies labels color of the axis. 276 | * @return GaugeAxis 277 | */ 278 | public GaugeAxis setColor(Color color) { 279 | this.color = color; 280 | return this; 281 | } 282 | 283 | public Color getColor() { 284 | return color; 285 | } 286 | 287 | /** 288 | * @param endAngle Axis end angle. Valid values are from - 180 to 180. 289 | * @return GaugeAxis 290 | */ 291 | public GaugeAxis setEndAngle(double endAngle) { 292 | this.endAngle = endAngle; 293 | return this; 294 | } 295 | 296 | public Double getEndAngle() { 297 | return endAngle; 298 | } 299 | 300 | /** 301 | * @param endValue Axis end (max) value 302 | * @return GaugeAxis 303 | */ 304 | public GaugeAxis setEndValue(double endValue) { 305 | this.endValue = endValue; 306 | return this; 307 | } 308 | 309 | public Double getEndValue() { 310 | return endValue; 311 | } 312 | 313 | /** 314 | * @param fontSize Font size for axis labels. 315 | * @return GaugeAxis 316 | */ 317 | public GaugeAxis setFontSize(double fontSize) { 318 | this.fontSize = fontSize; 319 | return this; 320 | } 321 | 322 | public Double getFontSize() { 323 | return fontSize; 324 | } 325 | 326 | /** 327 | * @param gridCount Number of grid lines. Note, GaugeAxis doesn't adjust gridCount, so you should check 328 | * your values and choose a proper gridCount which would result grids at round numbers. 329 | * @return GaugeAxis 330 | */ 331 | public GaugeAxis setGridCount(double gridCount) { 332 | this.gridCount = gridCount; 333 | return this; 334 | } 335 | 336 | public Double getGridCount() { 337 | return gridCount; 338 | } 339 | 340 | /** 341 | * @param gridInside Specifies if grid should be drawn inside or outside the axis. 342 | * @return GaugeAxis 343 | */ 344 | public GaugeAxis setGridInside(boolean gridInside) { 345 | this.gridInside = gridInside; 346 | return this; 347 | } 348 | 349 | public Boolean getGridInside() { 350 | return gridInside; 351 | } 352 | 353 | /** 354 | * @param id Unique id of an axis. 355 | * @return GaugeAxis 356 | */ 357 | public GaugeAxis setId(String id) { 358 | this.id = id; 359 | return this; 360 | } 361 | 362 | public String getId() { 363 | return id; 364 | } 365 | 366 | /** 367 | * @param inside Specifies if labels should be placed inside or outside the axis. 368 | * @return GaugeAxis 369 | */ 370 | public GaugeAxis setInside(boolean inside) { 371 | this.inside = inside; 372 | return this; 373 | } 374 | 375 | public Boolean getInside() { 376 | return inside; 377 | } 378 | 379 | /** 380 | * @param labelFrequency Frequency of labels. 381 | * @return GaugeAxis 382 | */ 383 | public GaugeAxis setLabelFrequency(double labelFrequency) { 384 | this.labelFrequency = labelFrequency; 385 | return this; 386 | } 387 | 388 | public Double getLabelFrequency() { 389 | return labelFrequency; 390 | } 391 | 392 | /** 393 | * @param labelOffset Distance from axis to the labels. 394 | * @return GaugeAxis 395 | */ 396 | public GaugeAxis setLabelOffset(double labelOffset) { 397 | this.labelOffset = labelOffset; 398 | return this; 399 | } 400 | 401 | public Double getLabelOffset() { 402 | return labelOffset; 403 | } 404 | 405 | /** 406 | * @param labelsEnabled Specifies if labels on the axis should be shown. 407 | * @return GaugeAxis 408 | */ 409 | public GaugeAxis setLabelsEnabled(boolean labelsEnabled) { 410 | this.labelsEnabled = labelsEnabled; 411 | return this; 412 | } 413 | 414 | public Boolean getLabelsEnabled() { 415 | return labelsEnabled; 416 | } 417 | 418 | /** 419 | * @param listeners You can add listeners of events using this property. Example: listeners = [{"event":"clickBand", 420 | * "method":handleClick}]; 421 | * @return GaugeAxis 422 | */ 423 | public GaugeAxis setListeners(List listeners) { 424 | this.listeners = listeners; 425 | return this; 426 | } 427 | 428 | public List getListeners() { 429 | return listeners; 430 | } 431 | 432 | /** 433 | * @param minorTickInterval Interval, at which minor ticks should be placed. 434 | * @return GaugeAxis 435 | */ 436 | public GaugeAxis setMinorTickInterval(double minorTickInterval) { 437 | this.minorTickInterval = minorTickInterval; 438 | return this; 439 | } 440 | 441 | public Double getMinorTickInterval() { 442 | return minorTickInterval; 443 | } 444 | 445 | /** 446 | * @param minorTickLength Length of a minor tick. 447 | * @return GaugeAxis 448 | */ 449 | public GaugeAxis setMinorTickLength(double minorTickLength) { 450 | this.minorTickLength = minorTickLength; 451 | return this; 452 | } 453 | 454 | public Double getMinorTickLength() { 455 | return minorTickLength; 456 | } 457 | 458 | /** 459 | * @param radius Axis radius. 460 | * @return GaugeAxis 461 | */ 462 | public GaugeAxis setRadius(String radius) { 463 | this.radius = radius; 464 | return this; 465 | } 466 | 467 | public String getRadius() { 468 | return radius; 469 | } 470 | 471 | /** 472 | * @param showFirstLabel Specifies if the first label should be shown. 473 | * @return GaugeAxis 474 | */ 475 | public GaugeAxis setShowFirstLabel(boolean showFirstLabel) { 476 | this.showFirstLabel = showFirstLabel; 477 | return this; 478 | } 479 | 480 | public Boolean getShowFirstLabel() { 481 | return showFirstLabel; 482 | } 483 | 484 | /** 485 | * @param showLastLabel Specifies if the last label should be shown. 486 | * @return GaugeAxis 487 | */ 488 | public GaugeAxis setShowLastLabel(boolean showLastLabel) { 489 | this.showLastLabel = showLastLabel; 490 | return this; 491 | } 492 | 493 | public Boolean getShowLastLabel() { 494 | return showLastLabel; 495 | } 496 | 497 | /** 498 | * @param startAngle Axis start angle. Valid values are from - 180 to 180. 499 | * @return GaugeAxis 500 | */ 501 | public GaugeAxis setStartAngle(double startAngle) { 502 | this.startAngle = startAngle; 503 | return this; 504 | } 505 | 506 | public Double getStartAngle() { 507 | return startAngle; 508 | } 509 | 510 | /** 511 | * @param startValue Axis start (min) value. 512 | * @return GaugeAxis 513 | */ 514 | public GaugeAxis setStartValue(double startValue) { 515 | this.startValue = startValue; 516 | return this; 517 | } 518 | 519 | public Double getStartValue() { 520 | return startValue; 521 | } 522 | 523 | /** 524 | * @param tickAlpha Opacity of axis ticks. 525 | * @return GaugeAxis 526 | */ 527 | public GaugeAxis setTickAlpha(double tickAlpha) { 528 | this.tickAlpha = tickAlpha; 529 | return this; 530 | } 531 | 532 | public Double getTickAlpha() { 533 | return tickAlpha; 534 | } 535 | 536 | /** 537 | * @param tickColor Color of axis ticks. 538 | * @return GaugeAxis 539 | */ 540 | public GaugeAxis setTickColor(Color tickColor) { 541 | this.tickColor = tickColor; 542 | return this; 543 | } 544 | 545 | public Color getTickColor() { 546 | return tickColor; 547 | } 548 | 549 | /** 550 | * @param tickLength Length of a major tick. 551 | * @return GaugeAxis 552 | */ 553 | public GaugeAxis setTickLength(double tickLength) { 554 | this.tickLength = tickLength; 555 | return this; 556 | } 557 | 558 | public Double getTickLength() { 559 | return tickLength; 560 | } 561 | 562 | /** 563 | * @param tickThickness Tick thickness. 564 | * @return GaugeAxis 565 | */ 566 | public GaugeAxis setTickThickness(double tickThickness) { 567 | this.tickThickness = tickThickness; 568 | return this; 569 | } 570 | 571 | public Double getTickThickness() { 572 | return tickThickness; 573 | } 574 | 575 | /** 576 | * @param topText Text displayed above the axis center. 577 | * @return GaugeAxis 578 | */ 579 | public GaugeAxis setTopText(String topText) { 580 | this.topText = topText; 581 | return this; 582 | } 583 | 584 | public String getTopText() { 585 | return topText; 586 | } 587 | 588 | /** 589 | * @param topTextBold Specifies if text should be bold. 590 | * @return GaugeAxis 591 | */ 592 | public GaugeAxis setTopTextBold(boolean topTextBold) { 593 | this.topTextBold = topTextBold; 594 | return this; 595 | } 596 | 597 | public Boolean getTopTextBold() { 598 | return topTextBold; 599 | } 600 | 601 | /** 602 | * @param topTextColor Color of top text. 603 | * @return GaugeAxis 604 | */ 605 | public GaugeAxis setTopTextColor(Color topTextColor) { 606 | this.topTextColor = topTextColor; 607 | return this; 608 | } 609 | 610 | public Color getTopTextColor() { 611 | return topTextColor; 612 | } 613 | 614 | /** 615 | * @param topTextFontSize Font size of top text. 616 | * @return GaugeAxis 617 | */ 618 | public GaugeAxis setTopTextFontSize(double topTextFontSize) { 619 | this.topTextFontSize = topTextFontSize; 620 | return this; 621 | } 622 | 623 | public Double getTopTextFontSize() { 624 | return topTextFontSize; 625 | } 626 | 627 | /** 628 | * @param topTextYOffset Y offset of top text. 629 | * @return GaugeAxis 630 | */ 631 | public GaugeAxis setTopTextYOffset(double topTextYOffset) { 632 | this.topTextYOffset = topTextYOffset; 633 | return this; 634 | } 635 | 636 | public Double getTopTextYOffset() { 637 | return topTextYOffset; 638 | } 639 | 640 | /** 641 | * @param unit A string which can be placed next to axis labels. 642 | * @return GaugeAxis 643 | */ 644 | public GaugeAxis setUnit(String unit) { 645 | this.unit = unit; 646 | return this; 647 | } 648 | 649 | public String getUnit() { 650 | return unit; 651 | } 652 | 653 | /** 654 | * @param unitPosition Position of the unit. 655 | * @return GaugeAxis 656 | */ 657 | public GaugeAxis setUnitPosition(String unitPosition) { 658 | this.unitPosition = unitPosition; 659 | return this; 660 | } 661 | 662 | public String getUnitPosition() { 663 | return unitPosition; 664 | } 665 | 666 | /** 667 | * @param usePrefixes *Specifies if small and big numbers should use prefixes to make them more readable. 668 | * @return GaugeAxis 669 | */ 670 | public GaugeAxis setUsePrefixes(boolean usePrefixes) { 671 | this.usePrefixes = usePrefixes; 672 | return this; 673 | } 674 | 675 | public Boolean getUsePrefixes() { 676 | return usePrefixes; 677 | } 678 | 679 | /** 680 | * @param valueInterval Interval, at which ticks with values should be placed. 681 | * @return GaugeAxis 682 | */ 683 | public GaugeAxis setValueInterval(double valueInterval) { 684 | this.valueInterval = valueInterval; 685 | return this; 686 | } 687 | 688 | public Double getValueInterval() { 689 | return valueInterval; 690 | } 691 | 692 | } --------------------------------------------------------------------------------