Infragistics UltraChart questions

Posted by ge1971 on 11-Apr-2012 04:40

I'm working on a simple 'popup' window to display data using the Infragistics WinChart control and have a couple of queries I'm hoping someone with more experience may be able to help out with.  I have no previous GUI for .NET experience (this is our first attempt); but thankfully the results shown in the attachments have been achieved with very little coding (the chart's data binding source is set to a query on a dynamically created temp-table at run-time).  Below is the only code which overrides the default behaviour.

    /* Set chart properties */   

    CASE pcChartStyle:      

      WHEN 'Column Chart' THEN DO:

        uchChart:ChartType = Infragistics.UltraChart.Shared.Styles.ChartType:ColumnChart.                               

        uchChart:Axis:X:Labels:Visible = FALSE.         

        uchChart:Data:SwapRowsAndColumns = FALSE.                                                      

      END.        

      WHEN 'Line Chart' THEN DO:

        uchChart:ChartType = Infragistics.UltraChart.Shared.Styles.ChartType:LineChart.               

        uchChart:Axis:X:Labels:Visible = TRUE.       

        uchChart:Axis:X:Labels:Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation:HORIZONTAL.

        uchChart:Data:SwapRowsAndColumns = TRUE.

      END.       

    END CASE.

    uchChart:Axis:X:LineThickness = 2.

    uchChart:Legend:Visible = TRUE.

    uchChart:Legend:Location = Infragistics.UltraChart.Shared.Styles.LegendLocation:Bottom.       

    uchChart:Legend:SpanPercentage = 10.   

(1) I would like to override the format of the X Axis Label format.  If you take a look at the attached file LineChart.jpg you'll see that the display format along the X Axis has defaulted to a DateTime format (DD/MM/YYYY HH:MM:SS). I'd like to change this to simply DD/MM/YYYY but I'm struggling to find the correct property to set; and the correct way to specify a format string under .NET

(2) Following on from the above; when I change the chart style to a Column Chart, I have found that I need to hide the X Axis labels in order to get the display I'd like to see (otherwise I get a label on each column - the attached ColChart.jpg and ColChart2.jpg shows the differences).  So if I want to change the format of the labels in my Column Charts as described in point (1) above; which property should I be looking at if it's not the X Axis Label format ?

(3) The chart's Legend labels default to Yvalue[1], Yvalue[2], etc; but I'd like them to read something like "2011" & "2010"; or "Rolling 12 months" and "Previous rolling 12 months" (to be set at run time). Again, I've not been able to track down the properties I need to change to achieve this.

Any pointers would be very much appreciated.

The resource cannot be found.

All Replies

Posted by ge1971 on 03-May-2012 04:51

After much digging, I've answered my own questions - figured they might be of use to others in the future, so here are some brief pointers to the solutions I found:

(1) It would appear the best way to override labels is to write a custom label renderer class that implements  Infragistics.UltraChart.Resources.IRenderLabel.

You have to do some work with hash tables (a concept I was not previously familiar with, but one which is worthwhile learning as it's very useful). If you do some searching through the Infragistics support forums you can find several examples.

(2) In order to get column charts to display the way I described I needed to set ultraChart:Axis:X:Labels:Visible to FALSE and set ultraChart:Data:SwapRowsAndColumns to TRUE.

Once you have done this, the values which are displayed under Column charts are not formatted by the ultraChart:Axis:X:Labels:ItemFormatString; it's the ultraChart:Axis:X:Labels:SeriesFormatString you need to work with.

(3) The ultraChart:Legend:FormatString can be overriden and set to whichever values you require by using the same principle described in (1) above (hash tables and custom label renderers).  The same goes for any labels in a chart (Axis labels, Legend labels, Tooltips, etc).

Posted by mkontwg on 08-Dec-2017 04:16

Hi can you please share your code, i want to use mine. but i need the logic steps behind first to modify it.

This thread is closed