1/* 2 * Copyright (C) 2022 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 16export function randomRgbColor(): string { 17 const letters = '0123456789ABCDEF'; 18 let color = '#'; 19 for (let i = 0; i < 6; i++) { 20 color += letters[Math.floor(Math.random() * 16)]; 21 } 22 return color; 23} 24 25export function isPointIsCircle(x1: number, y1: number, x2: number, y2: number, radius: number): boolean { 26 return Math.sqrt(Math.pow(Math.abs(x2 - x1), 2) + Math.pow(Math.abs(y2 - y1), 2)) < radius; 27} 28 29export const pieChartColors = [ 30 '#5b8ff9', 31 '#5ad8a6', 32 '#5d7092', 33 '#f6bd16', 34 '#e8684a', 35 '#6DC8EC', 36 '#9270CA', 37 '#FF9D4D', 38 '#269A99', 39 '#FF99C3', 40 '#0039AC', 41 '#229D00', 42 '#AEAEAE', 43 '#FFEE00', 44 '#FF3000', 45 '#CBE1FF', 46 '#6000FF', 47 '#A24900', 48 '#70FFFE', 49 '#FF00C4', 50]; 51