@@ -496,6 +496,8 @@ pub struct ScaleTicks {
496
496
skip_deserializing // FnWithArgs can't deser right now, might be solved in the future with a fancy serde deserializer
497
497
) ]
498
498
pub ( crate ) callback : FnWithArgs < 3 > ,
499
+ #[ serde( skip_serializing_if = "String::is_empty" , default ) ]
500
+ pub ( crate ) color : String ,
499
501
#[ serde( skip_serializing_if = "NumberString::is_empty" , default ) ]
500
502
pub ( crate ) count : NumberString ,
501
503
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -515,6 +517,8 @@ pub struct ScaleTicks {
515
517
516
518
#[ derive( Debug , Clone , Deserialize , Serialize , Default , PartialEq , Eq , PartialOrd , Ord ) ]
517
519
pub struct Title {
520
+ #[ serde( skip_serializing_if = "String::is_empty" , default ) ]
521
+ pub ( crate ) color : String ,
518
522
#[ serde( skip_serializing_if = "Option::is_none" ) ]
519
523
pub ( crate ) display : Option < bool > ,
520
524
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -549,6 +553,8 @@ pub struct LegendLabel {
549
553
pub ( crate ) boxHeight : Option < u32 > ,
550
554
#[ serde( skip_serializing_if = "Option::is_none" ) ]
551
555
pub ( crate ) boxWidth : Option < u32 > ,
556
+ #[ serde( skip_serializing_if = "String::is_empty" , default ) ]
557
+ pub ( crate ) color : String ,
552
558
#[ serde( skip_serializing_if = "FnWithArgs::is_empty" , skip_deserializing) ]
553
559
// FnWithArgs can't deser right now, might be solved in the future with a fancy serde deserializer
554
560
pub ( crate ) filter : FnWithArgs < 2 > ,
@@ -718,17 +724,23 @@ impl DatasetTrait for Vec<XYDataset> {
718
724
. into_iter ( )
719
725
. filter_map ( |xyd| {
720
726
let data = xyd. data . 0 . as_array ( ) ?;
727
+ // gloo_console::console_dbg!(&data);
721
728
let keys = data
722
729
. iter ( )
723
730
. filter_map ( |xy| xy. as_object ( ) )
724
731
. filter_map ( |obj| obj. get ( "x" ) )
725
- . filter_map ( |x| x. as_str ( ) )
732
+ . filter_map ( |x| {
733
+ x. as_str ( )
734
+ . map ( |s| s. to_string ( ) )
735
+ . or ( x. as_number ( ) . map ( |num| num. to_string ( ) ) )
736
+ } )
726
737
. map ( |x| x. into ( ) )
727
738
. collect :: < Vec < NumberOrDateString > > ( ) ;
728
739
Some ( keys)
729
740
} )
730
741
. flatten ( )
731
742
. collect :: < Vec < _ > > ( ) ;
743
+ // gloo_console::console_dbg!(&vec);
732
744
733
745
vec. sort_by ( crate :: get_order_fn) ;
734
746
vec. dedup ( ) ;
0 commit comments