我有一个数据集如下:
private void ButtonClick(object sender, RoutedEventArgs e)
{
int col = Grid.GetColumn((Button)sender); //this just returns 0
int row = Grid.GetRow((Button)sender); //this just returns 0
Button source = e.Source as Button;
source.Visibility = Visibility.Hidden;
Console.WriteLine("L: {0} x {1}", col, row); //prints L: 0 x 0
}
private void RightClick(object sender, RoutedEventArgs e)
{
int col = Grid.GetColumn((Button)sender); //this just returns 0
int row = Grid.GetRow((Button)sender); //this just returns 0
Button source = e.Source as Button;
if(source.Content.Equals(""))
{
source.Content = "\u2691";
}
else
{
source.Content = "";
}
Console.WriteLine("R: {0} x {1}", col, row); //prints R: 0 x 0
}
我的目标是使用plotly创建一个交互式的facet_wrap ggplot: https://plot.ly/ggplot2/getting-started/
DATE <- as.Date(c('2016-11-15','2016-11-15','2016-11-15', '2016-11-15', '2016-11-16', '2016-11-16', '2016-11-16', '2016-11-16'))
TYPE1 <- c('A','A','A', 'A','A','A','A','A')
TYPE2 <- c('uno','uno','dos', 'dos','uno','uno','dos','dos')
TYPE3 <- c('bueno', 'mal','bueno','mal','bueno','mal','bueno','mal')
Revenue <- c(97310.77, 51481.13, 1842.42, 2157.38, 55735.40, 56917.75, 1862.75, 551.23)
df <- data.frame(DATE, TYPE1, TYPE2, TYPE3, Revenue)
df
DATE TYPE1 TYPE2 TYPE3 Revenue
1 2016-11-15 A uno bueno 97310.77
2 2016-11-15 A uno mal 51481.13
3 2016-11-15 A dos bueno 1842.42
4 2016-11-15 A dos mal 2157.38
5 2016-11-16 A uno bueno 55735.40
6 2016-11-16 A uno mal 56917.75
7 2016-11-16 A dos bueno 1862.75
8 2016-11-16 A dos mal 551.23
质量真的不是那么好,因为我希望能够将鼠标悬停在不起作用的地方,当我自动缩放时,数字会从侧面移除。
从这篇文章中实现的目标:
1)将鼠标悬停在每个栏上时,显示值详细信息
2)将数字格式更改为$ amount
3)删除显示日期的一侧的图例,我按日期在条形图中着色,但我不需要图例。
4)自动缩放时,请将数字放在一边。
我知道这很多但是如果有人能够回答这些问题中的任何一个(最好是第一个目标)那将是一个巨大的帮助。谢谢!
答案 0 :(得分:1)
要启用悬停,您可以将<select class="q-select"
ngModel
name="answerForQuestion{{ question?.questionId }}">
<optgroup label="{{subCat?.subCat}}"
*ngFor="let subCat of accountTypes; let i = index;">
<option *ngFor="let acctType of subCat.accountTypes; let j = index;"
[ngValue]="acctType"
[selected]="i == 0 && j == 0">
{{ acctType?.displayName }}
</option>
</optgroup>
</select>
参数移至[selected]="i == 0 && j == 0"
美学:
fill
答案 1 :(得分:1)
想出来:
library(scales)
hp <- ggplot(df, aes(x=DATE, y=Revenue)) +
geom_bar(stat="identity", colour = "white")+
facet_grid(`TYPE2`~`TYPE3`, scales = "free", space = "free")