object ISeries.GetLegendItemImageSource(int index, ref C1.Chart._Size imageSize)
            {
                if (ShowCustomIcons)
                {
                    imageSize.Width  = 60;
                    imageSize.Height = 60;

                    SmartPhoneVendor vendor = ViewModel.SmartPhoneVendors.ElementAt(index);
                    if (vendor.ImageSource is BitmapImage)
                    {
                        // replace the BitmapImage with a new ImageSource wrapped in the legend item color
                        SolidColorBrush brush = new SolidColorBrush(vendor.Color);
                        vendor.ImageSource = makeLegendImageSource(vendor.ImageSource, brush, imageSize);
                    }

                    // Try and keep the original size of the logo bitmaps, but reduce their size if the chart window
                    // is too small to display the bitmaps properly.
                    double boundsHeight = ParentControl.ArrangeBounds.Height - 50;
                    double divadj       = (boundsHeight > 800) ? 13 : 25;
                    double fracHeight   = boundsHeight / divadj;
                    if (fracHeight < imageSize.Height)
                    {
                        imageSize.Width = imageSize.Height = fracHeight;
                    }

                    return(vendor.ImageSource);
                }
                else
                {
                    return(null);
                }
            }
示例#2
0
 object ISeries.GetLegendItemImageSource(int index, ref C1.Chart._Size imageSize)
 {
     if (ShowCustomIcons)
     {
         var bounds = Windows.UI.ViewManagement.ApplicationView.
                      GetForCurrentView().VisibleBounds;
         double divadj     = bounds.Height > 900 ? 15 : 35;
         double fracHeight = bounds.Height / divadj;
         imageSize.Width = imageSize.Height = fracHeight < 60 ? fracHeight : 60;
         SmartPhoneVendor vendor = SampleViewModel.SmartPhoneVendors.ElementAt(index);
         return(vendor.ImageSource);
     }
     else
     {
         return(null);
     }
 }