Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1004
IRenderLabel didnt work (asp.net mvc)
posted

I try to implement IRenderLabel Interface for Column Chart but it didnt work (LabelRenderer ist not call):

    public class LabelRenderer : IRenderLabel
    {
        /// <summary>
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string ToString(Hashtable context)
        {
            string resultString = string.Empty;
            double dataValue = (double)context["DATA_VALUE"];
            int dataValueModulo = 0;

            if(dataValue >= 1000000000 )
            {
                dataValueModulo =(int)dataValue % 1000000000;
                resultString = dataValueModulo.ToString() + "Mrd.";
            }

            return resultString;
        }
    }

---------------------

            ToRenderColumnChart.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:n0>";
            Hashtable LabelHashTable = new Hashtable();
            LabelHashTable.Add("DATA_VALUE", new LabelRenderer());
            ToRenderColumnChart.LabelHash = LabelHashTable;

Please Help me, asp.

Thank you very much

Parents
No Data
Reply
  • 26458
    Suggested Answer
    Offline posted

    You won't be able to use any of the predefined label tokens, such as DATA_VALUE, ITEM_LABEL, etc.
    You have to create a custom token, like MY_DATA_VALUE and you'll see IRenderLabel.ToString being called. Your context hash table will already have data_value and other predefined tokens.

Children