使用评论标记的问题内容链接到JSFiddle:https://jsfiddle.net/z1q7aqo3/ 具体而言,需要填写的部分是
public String capWordFirstLetter(String fullname)
{
String fname = "";
String s2;
StringTokenizer tokenizer = new StringTokenizer(fullname);
while (tokenizer.hasMoreTokens())
{
s2 = tokenizer.nextToken().toLowerCase();
if (fname.length() == 0)
fname += s2.substring(0, 1).toUpperCase() + s2.substring(1);
else
fname += " "+s2.substring(0, 1).toUpperCase() + s2.substring(1);
}
return fname;
}
我有一个包含许多系列的折线图。在鼠标悬停时,工具提示按排序顺序显示所有值的所有值。这部分已经完成,可以在JSFiddle中看到。我的问题是,我希望工具提示中每个系列的每个文本都包含用于该系列的标记符号,并以系列的颜色设置样式。颜色样式也很完整,可以在JSFiddle中看到,但我如何获得标记符号?
答案 0 :(得分:0)
Modifying form earlier Answer它适用于个别系列工具提示。这里修改为共享工具提示
Fiddle演示
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
void createBoard(int size, int xPos, int yPos);
void printBoard(char board[50][50]);
int main()
{
int xPos = 32, yPos = 21, bSize = 50;
createBoard(bSize, xPos, yPos);
int x = 42, y = 32; //Starting coords for player
while(1){
if(GetKeyState(65)<0){ //left
//gotoXY(x, y);
//printf('-');
x-=2; //Moves 1 space left
gotoXY(x, y);
printf("@");
}
if(GetKeyState(83)<0){ //down
y+=2;
gotoXY(x, y);
printf("@");
}
if(GetKeyState(68)<0){ //right
x+=2;
gotoXY(x, y);
printf("@");
}
if(GetKeyState(87)<0){ //up
y-=2;
gotoXY(x, y);
printf("@");
}
}
return 0;
}
void printBoard(char board[50][50]){
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
int i, j;
for(i = 0; i < 50; i++){
for(j = 0; j < 50; j++){
SetConsoleTextAttribute(hConsole,7); //Sets tiles to white
if(board[i][j]=='@'){
SetConsoleTextAttribute(hConsole, 4); //Sets @ to red
}
printf("%c ", board[i][j]);
}
printf("\n");
}
}
void createBoard(int size, int xPos, int yPos){
int i, j;
char sampleBoard[size][size], person = '@';
for(i = 0; i < size; i++){
for(j = 0; j < size; j++){
sampleBoard[i][j] = '-';
}
}
sampleBoard[xPos][yPos] = person;
printBoard(sampleBoard);
}
void gotoXY(int x, int y) {
//Initialize the coordinates
COORD coord = {x, y};
//Set the position
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
return;
}