2 * Copyright (C) 2009 - 2012 SC 4ViewSoft SRL
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.achartengine.chart;
19 * The chart point style enumerator.
21 public enum PointStyle {
22 X("x"), CIRCLE("circle"), TRIANGLE("triangle"), SQUARE("square"), DIAMOND("diamond"), POINT(
25 /** The point shape name. */
29 * The point style enum constructor.
31 * @param name the name
33 private PointStyle(String name) {
38 * Returns the point shape name.
40 * @return the point shape name
42 public String getName() {
47 * Returns the point shape name.
49 * @return the point shape name
51 public String toString() {
56 * Return the point shape that has the provided symbol.
58 * @param name the point style name
59 * @return the point shape
61 public static PointStyle getPointStyleForName(String name) {
62 PointStyle pointStyle = null;
63 PointStyle[] styles = values();
64 int length = styles.length;
65 for (int i = 0; i < length && pointStyle == null; i++) {
66 if (styles[i].mName.equals(name)) {
67 pointStyle = styles[i];
74 * Returns the point shape index based on the given name.
76 * @return the point shape index
78 public static int getIndexForName(String name) {
80 PointStyle[] styles = values();
81 int length = styles.length;
82 for (int i = 0; i < length && index < 0; i++) {
83 if (styles[i].mName.equals(name)) {
87 return Math.max(0, index);