@@ -157,10 +157,7 @@ class BarHorizontalSortedTemplate(Template):
157
157
"sort" : "-x" ,
158
158
},
159
159
"yOffset" : {"field" : "rev" },
160
- "color" : {
161
- "field" : "rev" ,
162
- "type" : "nominal" ,
163
- },
160
+ "color" : Template .anchor ("color" ),
164
161
},
165
162
}
166
163
@@ -188,10 +185,7 @@ class BarHorizontalTemplate(Template):
188
185
"title" : Template .anchor ("y_label" ),
189
186
},
190
187
"yOffset" : {"field" : "rev" },
191
- "color" : {
192
- "field" : "rev" ,
193
- "type" : "nominal" ,
194
- },
188
+ "color" : Template .anchor ("color" ),
195
189
},
196
190
}
197
191
@@ -441,10 +435,8 @@ class ScatterTemplate(Template):
441
435
"type" : "quantitative" ,
442
436
"title" : Template .anchor ("y_label" ),
443
437
},
444
- "color" : {
445
- "field" : "rev" ,
446
- "type" : "nominal" ,
447
- },
438
+ "color" : Template .anchor ("color" ),
439
+ "shape" : Template .anchor ("shape" ),
448
440
},
449
441
}
450
442
@@ -472,10 +464,8 @@ class ScatterJitterTemplate(Template):
472
464
"field" : Template .anchor ("y" ),
473
465
"title" : Template .anchor ("y_label" ),
474
466
},
475
- "color" : {
476
- "field" : "rev" ,
477
- "type" : "nominal" ,
478
- },
467
+ "color" : Template .anchor ("color" ),
468
+ "shape" : Template .anchor ("shape" ),
479
469
"xOffset" : {"field" : "randomX" , "type" : "quantitative" },
480
470
"yOffset" : {"field" : "randomY" , "type" : "quantitative" },
481
471
},
@@ -502,15 +492,26 @@ class SmoothLinearTemplate(Template):
502
492
},
503
493
},
504
494
],
495
+ "encoding" : {
496
+ "x" : {
497
+ "field" : Template .anchor ("x" ),
498
+ "type" : "quantitative" ,
499
+ "title" : Template .anchor ("x_label" ),
500
+ },
501
+ "color" : Template .anchor ("color" ),
502
+ "strokeDash" : Template .anchor ("stroke_dash" ),
503
+ "shape" : Template .anchor ("shape" ),
504
+ },
505
505
"layer" : [
506
506
{
507
- "mark" : "line" ,
508
- "encoding" : {
509
- "x" : {
510
- "field" : Template .anchor ("x" ),
511
- "type" : "quantitative" ,
512
- "title" : Template .anchor ("x_label" ),
507
+ "layer" : [
508
+ {"mark" : "line" },
509
+ {
510
+ "transform" : [{"filter" : {"param" : "hover" , "empty" : False }}],
511
+ "mark" : "point" ,
513
512
},
513
+ ],
514
+ "encoding" : {
514
515
"y" : {
515
516
"field" : Template .anchor ("y" ),
516
517
"type" : "quantitative" ,
@@ -521,18 +522,6 @@ class SmoothLinearTemplate(Template):
521
522
"field" : "rev" ,
522
523
"type" : "nominal" ,
523
524
},
524
- "tooltip" : [
525
- {
526
- "field" : Template .anchor ("x" ),
527
- "title" : Template .anchor ("x_label" ),
528
- "type" : "quantitative" ,
529
- },
530
- {
531
- "field" : Template .anchor ("y" ),
532
- "title" : Template .anchor ("y_label" ),
533
- "type" : "quantitative" ,
534
- },
535
- ],
536
525
},
537
526
"transform" : [
538
527
{
@@ -558,26 +547,10 @@ class SmoothLinearTemplate(Template):
558
547
"scale" : {"zero" : False },
559
548
},
560
549
"color" : {"field" : "rev" , "type" : "nominal" },
561
- "tooltip" : [
562
- {
563
- "field" : Template .anchor ("x" ),
564
- "title" : Template .anchor ("x_label" ),
565
- "type" : "quantitative" ,
566
- },
567
- {
568
- "field" : Template .anchor ("y" ),
569
- "title" : Template .anchor ("y_label" ),
570
- "type" : "quantitative" ,
571
- },
572
- ],
573
550
},
574
551
},
575
552
{
576
- "mark" : {
577
- "type" : "circle" ,
578
- "size" : 10 ,
579
- "tooltip" : {"content" : "encoding" },
580
- },
553
+ "mark" : {"type" : "circle" , "size" : 10 },
581
554
"encoding" : {
582
555
"x" : {
583
556
"aggregate" : "max" ,
@@ -595,6 +568,38 @@ class SmoothLinearTemplate(Template):
595
568
"color" : {"field" : "rev" , "type" : "nominal" },
596
569
},
597
570
},
571
+ {
572
+ "transform" : [
573
+ {
574
+ "pivot" : Template .anchor ("group_by" ),
575
+ "value" : Template .anchor ("y" ),
576
+ "groupby" : [Template .anchor ("x" )],
577
+ }
578
+ ],
579
+ "mark" : {
580
+ "type" : "rule" ,
581
+ "tooltip" : {"content" : "data" },
582
+ "stroke" : "grey" ,
583
+ },
584
+ "encoding" : {
585
+ "opacity" : {
586
+ "condition" : {"value" : 0.3 , "param" : "hover" , "empty" : False },
587
+ "value" : 0 ,
588
+ }
589
+ },
590
+ "params" : [
591
+ {
592
+ "name" : "hover" ,
593
+ "select" : {
594
+ "type" : "point" ,
595
+ "fields" : [Template .anchor ("x" )],
596
+ "nearest" : True ,
597
+ "on" : "mouseover" ,
598
+ "clear" : "mouseout" ,
599
+ },
600
+ }
601
+ ],
602
+ },
598
603
],
599
604
}
600
605
@@ -628,10 +633,9 @@ class SimpleLinearTemplate(Template):
628
633
"title" : Template .anchor ("y_label" ),
629
634
"scale" : {"zero" : False },
630
635
},
631
- "color" : {
632
- "field" : "rev" ,
633
- "type" : "nominal" ,
634
- },
636
+ "color" : Template .anchor ("color" ),
637
+ "strokeDash" : Template .anchor ("stroke_dash" ),
638
+ "shape" : Template .anchor ("shape" ),
635
639
},
636
640
}
637
641
0 commit comments