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
105
Dynamically changes Y axis values in datachart bargraph
posted

How to dispaly dynamically changes Y-Axis values for each request.

For exmaple data:X-axis  and Y-axis data  for ecach requset. but Y-axis data will change dynamically for each request.

X-Axis --         Y-axiss

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

11/02/2014     2000

12/05/2014     2200

01/26/2015     21000

==============

11/10/2014    0.56%

12/19/2014    0.62%

===============

11/10/2014   5

12/19/2014   14

02/13/2015   7

===============

Note: Y-axis value has Min and Max values. The value is less than Min value then display in Green bar and values is Grater than Max value disply in Red and in between display in Yellow Bar.

How to diplay this type of data in  silverlight  using xamDataChart with bargraph in diffirent colors as mentioned above.

 

 

 

 

  • 34510
    Verified Answer
    Offline posted

    Hi Venkateswarlu,

    You can change what values are shown in the Y axis by changing the Minimum and Maximum properties.  If one series requires the ability to show data points with 2000, 2100, and 21000 as the Y values then setting the Minimum and Maximum to encapsulate update the Y axis labels to show that range.  The same for a different series needing to show percentages.  You cannot have one Y axis showing all of these different values though.  A single NumericYAxis can only show a range of values between a minimum and a maximum.

    For changing the bar colors, I'm a bit confused by your requirement.  If you have the Minimum and Maximum values set, and your bar value is less than the minimum, the XamDataChart is not going to show that bar so there is no point in giving it a color.  However, if you need to change the color of the bars, please see the following forum thread:
    https://www.infragistics.com/community/forums/f/retired-products-and-controls/48210/colouring-columns-bars-in-the-chart-based-on-value/256989#256989

    • 105
      Offline posted in reply to Robert Stoffers

      Hello Sir,

          Y-Axis starts with  Zeero as Minimum  value. In my date all rows contains Minimum and Maximum Values and also contains result values with corsponding dates. I want draw bar garp with Result values(Y-axis) and Dates(X-axis). If the Result value is less than Minimum value show in green, greater than maximum value show in Red and in between show in Yellow.

      Can you please send me example.

       

      Thanks,

      • 34510
        Offline posted in reply to Venkateswarlu Kallur

        Hi Venkateswarlu,

        Sorry for the late reply.  I actually reworked the sample so that instead of calculating the desired color inside a behavior, I calculate it inside each data point separately.  I then just pull the color from the data point and use that to color each column.  This also allows me to easily bind the tooltip template to use the color.  By default the template will use the Series.ActualBrush for the color so overriding the template is a must if you want to change its color.  Take a look at my attached sample.

        ConditionalColoringSL.zip
        • 105
          Offline posted in reply to Robert Stoffers

           Tool Top color doesn't change . How to change the Tool Tip color same as bar grapg color.

          • 105
            Offline posted in reply to Robert Stoffers

            Hi,

               Every thing working fine but Tool Top color doesn't change . How to change the Tool Tip color same as bar grapg color.

             

            Thanks,

            Venky

            • 34510
              Offline posted in reply to Robert Stoffers

              Just realized that this is in the Silverlight forums.  I updated the sample to use Silverlight rather than WPF.  The approach is still the same though.

              ConditionalColoringSL.zip
              • 34510
                Offline posted in reply to Venkateswarlu Kallur

                Hi Venkateswarlu,

                I attached a sample that changes the color of the column based on the result in relation to a min/max value.  Graham's code from that previous forum post I linked doesn't appear to work anymore in newer versions of the chart so I created a Behavior<T> that will do this instead.  The Behavior<T> handles the RefreshCompleted event on the chart and then grabs the Rectangle objects from the ColumnSeries canvas.  It then sets the Fill property based on the Result value.

                ConditionalColoring.zip