View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.client.console.chartjs;
20  
21  /**
22   * Provides options, that are available for {@link Pie}.
23   */
24  public class PieChartOptions extends ChartOptions {
25  
26      private static final long serialVersionUID = -5356780831848556616L;
27  
28      /** The segment show stroke. */
29      private Boolean segmentShowStroke;
30  
31      /** The segment stroke color. */
32      private String segmentStrokeColor;
33  
34      /** The segment stroke width. */
35      private Integer segmentStrokeWidth;
36  
37      /** The animate rotate. */
38      private Boolean animateRotate;
39  
40      /** The animate scale. */
41      private Boolean animateScale;
42  
43      private String legendTemplate = "<ul class=\"<%=name.toLowerCase()%>-legend\">"
44              + "<% for (var i=0; i<segments.length; i++){%><li>"
45              + "<span style=\"background-color:<%=segments[i].fillColor%>\">"
46              + "<%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>";
47  
48      public String getLegendTemplate() {
49          return legendTemplate;
50      }
51  
52      public void setLegendTemplate(final String legendTemplate) {
53          this.legendTemplate = legendTemplate;
54      }
55  
56      /**
57       * Gets the segment show stroke.
58       *
59       * @return the segment show stroke
60       */
61      public Boolean getSegmentShowStroke() {
62          return segmentShowStroke;
63      }
64  
65      /**
66       * Sets the segment show stroke.
67       *
68       * @param segmentShowStroke decides whether we should show a stroke on each segment (default is true)
69       */
70      public void setSegmentShowStroke(final Boolean segmentShowStroke) {
71          this.segmentShowStroke = segmentShowStroke;
72      }
73  
74      /**
75       * Gets the segment stroke color.
76       *
77       * @return the segment stroke color
78       */
79      public String getSegmentStrokeColor() {
80          return segmentStrokeColor;
81      }
82  
83      /**
84       * Sets the segment stroke color.
85       *
86       * @param segmentStrokeColor the new segment stroke color (default is "#fff").
87       */
88      public void setSegmentStrokeColor(final String segmentStrokeColor) {
89          this.segmentStrokeColor = segmentStrokeColor;
90      }
91  
92      /**
93       * Gets the segment stroke width.
94       *
95       * @return the segment stroke width
96       */
97      public Integer getSegmentStrokeWidth() {
98          return segmentStrokeWidth;
99      }
100 
101     /**
102      * Sets the segment stroke width.
103      *
104      * @param segmentStrokeWidth the new segment stroke width (default is 2).
105      */
106     public void setSegmentStrokeWidth(final Integer segmentStrokeWidth) {
107         this.segmentStrokeWidth = segmentStrokeWidth;
108     }
109 
110     /**
111      * Gets the animate rotate.
112      *
113      * @return the animate rotate
114      */
115     public Boolean getAnimateRotate() {
116         return animateRotate;
117     }
118 
119     /**
120      * Sets the animate rotate.
121      *
122      * @param animateRotate decides whether we animate the rotation of the pie (default is true).
123      */
124     public void setAnimateRotate(final Boolean animateRotate) {
125         this.animateRotate = animateRotate;
126     }
127 
128     /**
129      * Gets the animate scale.
130      *
131      * @return the animate scale
132      */
133     public Boolean getAnimateScale() {
134         return animateScale;
135     }
136 
137     /**
138      * Sets the animate scale.
139      *
140      * @param animateScale decides whether we animate scaling the Pie from the center (default is false).
141      */
142     public void setAnimateScale(final Boolean animateScale) {
143         this.animateScale = animateScale;
144     }
145 }