Jump to content
  • How to Change the Color of the Median in a Box Plot Visualization Using the Spotfire® C# API


    This article contains sample C# code that illustrates how to change the color of the median in a boxplot visualization. The main purpose of the article is to show how a developer can access the BoxPlotReferencePoint and set any available properties, such as color.

    Introduction

    This article contains sample C# code that illustrates how to change the color of the median in a boxplot visualization. The main purpose of the article is to show how a developer can access the BoxPlotReferencePoint and set any available properties, such as color

    Code Sample

    // Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    public static void someMethodName(AnalysisApplication application)
    {
        BoxPlot boxPlot = application.Document.ActiveVisualReference.As<BoxPlot>();
    
        List<String> mypoints = new List<string>();
        string hexValue = "#FF00FF"; // You do need the hash
        Color colour = System.Drawing.ColorTranslator.FromHtml(hexValue);
    
        foreach (BoxPlotReferencePoint point in boxPlot.ReferencePoints)
        {
            String name = point.MethodName;
            mypoints.Add(name);
            String pt = mypoints.Find(item => item.Equals("Median"));
            if (pt == "Median")
            {
    		    point.Color= colour;
            }
        }
    }
     

    References

     

     

    License:  TIBCO BSD-Style License


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...