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 Bar}.
23   */
24  public class BarChartOptions extends ChartOptions {
25  
26      private static final long serialVersionUID = -5356780831848556616L;
27  
28      /**
29       * Whether to show horizontal lines (except X axis).
30       */
31      private Boolean scaleShowHorizontalLines = true;
32  
33      /**
34       * Whether to show vertical lines (except Y axis).
35       */
36      private Boolean scaleShowVerticalLines = true;
37  
38      /**
39       * A legend template.
40       */
41      private String legendTemplate = "<ul class=\"<%=name.toLowerCase()%>-legend\">"
42              + "<% for (var i=0; i<datasets.length; i++){%><li>"
43              + "<span style=\"background-color:<%=datasets[i].fillColor%>\"></span>"
44              + "<%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>";
45  
46      /**
47       * The bar show stroke.
48       */
49      private Boolean barShowStroke;
50  
51      /**
52       * The bar stroke width.
53       */
54      private Integer barStrokeWidth;
55  
56      /** The bar value spacing. */
57      private Integer barValueSpacing;
58  
59      /** The bar dataset spacing. */
60      private Integer barDatasetSpacing;
61  
62      public Boolean getScaleShowHorizontalLines() {
63          return scaleShowHorizontalLines;
64      }
65  
66      public void setScaleShowHorizontalLines(final Boolean scaleShowHorizontalLines) {
67          this.scaleShowHorizontalLines = scaleShowHorizontalLines;
68      }
69  
70      public Boolean getScaleShowVerticalLines() {
71          return scaleShowVerticalLines;
72      }
73  
74      public void setScaleShowVerticalLines(final Boolean scaleShowVerticalLines) {
75          this.scaleShowVerticalLines = scaleShowVerticalLines;
76      }
77  
78      public String getLegendTemplate() {
79          return legendTemplate;
80      }
81  
82      public void setLegendTemplate(final String legendTemplate) {
83          this.legendTemplate = legendTemplate;
84      }
85  
86      /**
87       * Gets the bar show stroke.
88       *
89       * @return the bar show stroke
90       */
91      public Boolean getBarShowStroke() {
92          return barShowStroke;
93      }
94  
95      /**
96       * Sets the bar show stroke.
97       *
98       * @param barShowStroke the new bar show stroke (default is true).
99       */
100     public void setBarShowStroke(final Boolean barShowStroke) {
101         this.barShowStroke = barShowStroke;
102     }
103 
104     /**
105      * Gets the bar stroke width.
106      *
107      * @return the bar stroke width
108      */
109     public Integer getBarStrokeWidth() {
110         return barStrokeWidth;
111     }
112 
113     /**
114      * Sets the bar stroke width.
115      *
116      * @param barStrokeWidth the new bar stroke width (default is 2).
117      */
118     public void setBarStrokeWidth(final Integer barStrokeWidth) {
119         this.barStrokeWidth = barStrokeWidth;
120     }
121 
122     /**
123      * Gets the bar value spacing.
124      *
125      * @return the bar value spacing
126      */
127     public Integer getBarValueSpacing() {
128         return barValueSpacing;
129     }
130 
131     /**
132      * Sets the bar value spacing.
133      *
134      * @param barValueSpacing the spacing between each of the X value sets (default is 5)
135      */
136     public void setBarValueSpacing(final Integer barValueSpacing) {
137         this.barValueSpacing = barValueSpacing;
138     }
139 
140     /**
141      * Gets the bar dataset spacing.
142      *
143      * @return the bar dataset spacing
144      */
145     public Integer getBarDatasetSpacing() {
146         return barDatasetSpacing;
147     }
148 
149     /**
150      * Sets the bar dataset spacing.
151      *
152      * @param barDatasetSpacing the spacing between data sets within X values (default is 1).
153      */
154     public void setBarDatasetSpacing(final Integer barDatasetSpacing) {
155         this.barDatasetSpacing = barDatasetSpacing;
156     }
157 }