1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package ohos.devtools.views.charts.tooltip; 17 18 import java.awt.Color; 19 20 /** 21 * Tooltip中的要显示的图例 22 * 23 * @since 2021/1/19 21:35 24 */ 25 public class TooltipItem { 26 /** 27 * Tooltip中图例色块的颜色 28 */ 29 private Color color; 30 31 /** 32 * 文本 33 */ 34 private String text; 35 36 private String name; 37 38 /** 39 * TooltipItem 40 */ TooltipItem()41 public TooltipItem() { 42 super(); 43 } 44 45 /** 46 * 构造函数 47 * 48 * @param color Tooltip中图例色块的颜色 49 * @param text tips文本 50 */ TooltipItem(Color color, String text)51 public TooltipItem(Color color, String text) { 52 this.color = color; 53 this.text = text; 54 } 55 getColor()56 public Color getColor() { 57 return color; 58 } 59 setColor(Color color)60 public void setColor(Color color) { 61 this.color = color; 62 } 63 getText()64 public String getText() { 65 return text; 66 } 67 setText(String text)68 public void setText(String text) { 69 this.text = text; 70 } 71 getName()72 public String getName() { 73 return name == null ? "Result Value" : name; 74 } 75 setName(String name)76 public void setName(String name) { 77 this.name = name; 78 } 79 } 80