Incident Details
Assigned to Employee: Randy Jimenez
  Incident ID:
Title: Axis Min and Max Question
Creator:  Will Lo  (will.lo@canadatech.com) Created: 5/19/2009 # of Updates: 8 Current Status: Completed
Latest Reply
History


Reply# 8 by: Randy Jimenez (Software FX) Date: 6/5/2009 5:01:23 PMEST
Dear Will Lo:

You mentioned that you use a TextProvider because your data cannot be always in a format that the TextProvider accepts (the text file contains extra information that isn’t plotable data). However, please note that you are able to instruct Chart FX to ignore specific fields from the result set, as shown below (refer to the third line):

To configure how the first 3 columns of a ResultSet should be used by a chart:

chart1.DataSourceSettings.Fields[0].Usage = FieldUsage.Value;
chart1.DataSourceSettings.Fields[1].Usage = FieldUsage.XValue;
chart1.DataSourceSettings.Fields[2].Usage = FieldUsage.NotUsed;
Alternatively, please note that you can also pass data manually through the use of the API as shown below:

chart1.Data.Series = 1;
chart1.Data.Points = 3;
chart1.Data[0, 0] = 30;
chart1.Data[0, 1] = 50;
chart1.Data[0, 2] = 20;

Regards,

Randy Jimenez
Software FX Support


Reply# 7 by: Will Lo Date: 6/5/2009 4:27:21 PMEST

Hello Randy

 

I am glad to hear that you were able to replicate the problem on your end.

 

Is there a data type, other than a ListProvider, which I can use to pass my data into the chart and have the min and max values set properly? I cannot use a TextProvider because my data cannot always been in a format that the TextProvider accepts. My data does come from a text file, but the text file contains extra information that isn’t plotable data. I read the file in and parse out the usable data, then pass it into the chart via ListProvider.

 

Or perhaps you can provide me an expected timeline of when the bug will be resolved? I am under a deadline too, and I need to inform my project manager of any deviations from our projected schedule.

 

Thanks.

 

Will Lo

Software Developer

Canada Tech

#7, 7875 - 48 Ave.

Red Deer, AB Canada, T4P 2K1

Office: 403-314-3659



Reply# 6 by: Randy Jimenez (Software FX) Date: 6/5/2009 3:38:23 PMEST
Dear Will Lo:

Thanks for contacting Software FX Support.

We have been able to replicate the problem in question. Although this is a rare situation, there are particular scenarios (as in this case) in which an unexpected behavior may be experienced. The issue seems to occur only when using the listprovider. I have submitted this problem to our development team for analysis. It is going to be attended according to the severity of the problem and the priority assigned by our development team. In the case of this being a bug, please note that the timeframe for bug resolutions will vary depending on the severity of the bug. Once a bug is fixed, it is usually made available as part of the next service pack. Thank you for your patience while we solve this issue and sorry for any inconveniences.

Regards,

Randy Jimenez
Software FX Support


Reply# 5 by: Will Lo Date: 6/2/2009 11:18:45 AMEST

Hi Randy

 

Here is the most simplistic code sample that replicates the problem. I use the ZoomScrollBar demo project, supplied on the Chart FX website, as my example.

 

In the PassDataToChart() method, replace all the lines in that method with the following lines:

 

            // array list to hold data points

            ArrayList dataPoints = new ArrayList();

            // object array containing the array list to be passed into ListProvider

            object[] myObjArray = new object[1];

 

            // fill the array list with some data points

            for (int i = 0; i < 25; i++)

            {

                dataPoints.Add(i);

            }

 

            myObjArray[0] = dataPoints;

           

// using ListProvider instead of TextProvider

            ListProvider listProvider1 = new ListProvider(myObjArray);

            ListProvider listProvider2 = new ListProvider(myObjArray);

 

            chartWhole.DataSourceSettings.DataSource = listProvider1;

            chartDetail.DataSourceSettings.DataSource = listProvider2;

 

            chartWhole.RecalculateScale();

            chartDetail.RecalculateScale();

 

Don’t forget to include the System.Collections name space in order to get the ArrayList to work.

 

So what I have done here is replace the TextProvider with a ListProvider, you’ll notice that using the ListProvider, the min and max axis values do not get set properly, or set at all for that matter. Returning the demo back to using a TextProvider, the min and max values are set properly.

 

 

Will Lo

Software Developer

Canada Tech

#7, 7875 - 48 Ave.

Red Deer, AB Canada, T4P 2K1

Office: 403-314-3659



Reply# 4 by: Randy Jimenez (Software FX) Date: 6/1/2009 7:41:39 PMEST
Dear Will Lo:

Please accept my apologies for the delay in getting back to you. We have received an usual high volume of incidents.

You mentioned the problem is related to the fact that the min and max properties of the chart are not being set to the actual min and max values of the data you are passing. However in order to replicate the issue on our side we will need you to provide us with the simplest form of the code that reproduces the problem. Since there could be other lines of code the ones causing the problem, you will need to isolate a form including only the code that replicates the issue in question. Please remove the extra-code that is not related to Chart FX so we can focus on the problem itself and provide you with an accurate solution with the least possible delay.

Regards,

Randy Jimenez
Software FX Support


Reply# 3 by: Will Lo Date: 5/28/2009 2:09:52 PMEST

Hello Randy, thank you for the reply.

 

I am using ChartFX 7 with the latest service pack installed (7.0.3306.26568). I am writing in Visual Studio 2008 for C#.

 

The code sample I am supplying is a bit extensive, so I will try my best to explain as much as possible. The data source I am giving the chart is stored in a custom linked list. Each list node is an object I made which contains several variables. The ‘data’ variable is the most important here, because this is where each curve’s data points are stored, in a form of an ArrayList.

 

Here is a portion of my node class:

 

public class node

{

    // pointer references to next and previous nodes

    public node next, prev;

 

    public string columnName;

    public string units;

 

    // curve data points stored here

    public ArrayList data;

 

    public int maxDecimalPlace;

    public bool showCurve;

    public bool axisForceZero;

    public bool isXAxis;

    public Color curveColor;

    public DashStyle curveLineStyle;

    public MarkerShape curverMarkerShape;

    public short curveLineWidth;

 

    /// <summary>

    /// empty constructor

    /// </summary>

    public node()

    {

 

    }

}

 

Each of my nodes contain enough information to plot a single curve. So basically, each node IS a curve on the chart. When I need to plot multiple curves, I store each of these curves in the linked list. I traverse the list, from beginning to end, when I want to plot all the curves onto a single chart. As I go through each node, I add the node’s ArrayList of data points into an array of Objects called ‘allArrays’. After I’m done traversing the list, I create a ListProvider with the allArrays and then set the chart’s data source to my List Provide.

 

Here is my method for plotting curves:

 

        private void plotGraph()

        {

            // begin at the end of the linked list

            node myNode = dataList.tail;

 

            // clear chart data

            chartWhole.Data.Clear();

 

            // linked list node must contain data

            if (myNode != null)

            {

                int index = 0;

 

                // object array that stores each curve's data set

                // this will be passed into a ListProvider for the chart

                object[] allArrays = new object[dataList.numberOfVisableCurves()];

 

                // set the number of series and data points

                // performace note: manually setting the number of series and data point values will

                // improve plotting performace as dynamically changing the number of series and points

                // will impact performace significantly

                chartWhole.Data.Series = dataList.numberOfVisableCurves();

                chartWhole.Data.Points = myNode.data.Count;

 

                // traverse the linked list

                while (myNode != null)

                {

                    if ((myNode.showCurve) && !(myNode.isXAxis))

                    {

                        // initialize chart visual attributes

                        chartWhole.Series[index].Color = myNode.curveColor;

                        chartWhole.Series[index].Line.Style = myNode.curveLineStyle;

                        chartWhole.Series[index].MarkerShape = myNode.curverMarkerShape;

                        chartWhole.Series[index].Line.Width = myNode.curveLineWidth;

                        chartWhole.Series[index].PointLabels.Visible = false;

 

                        // data is an ArrayList in the node that stores the curve's data points

                        allArrays[index] = myNode.data;

                       

                        // set the series name

                        chartWhole.Series[index].Text = myNode.columnName + " " + myNode.units;

 

                        // create a new axis for each curve

                        AxisY AddlAxisY = new AxisY();

                        AddlAxisY.TextColor = chartWhole.Series[index].Color;

                        AddlAxisY.Visible = true;

 

                        // divide first half of axis titles on the left side

                        if (index < ((float)dataList.numberOfVisableCurves() - 1) / (float)2)

                        {

                            AddlAxisY.Position = AxisPosition.Near;

                        }

                        // divide last half of axis titles on the right side

                        else

                        {

                            AddlAxisY.Position = AxisPosition.Far;

                        }

 

                        AddlAxisY.ForceZero = myNode.axisForceZero;

                        AddlAxisY.LabelsFormat.Decimals = myNode.maxDecimalPlace;

                        chartWhole.AxesY.Add(AddlAxisY);

                        chartWhole.Series[index].AxisY = AddlAxisY;

 

                        index++;

                    }

 

                    myNode = myNode.prev;

                }

 

                // create the list provider that contains the Object array of data points

                ListProvider lstProvider = new ListProvider(allArrays);

                chartWhole.DataSourceSettings.DataSource = lstProvider;

 

                // x-axis labels

                chartWhole.AxisX.Visible = true;

                // x-axis title

                chartWhole.AxisX.Title.Text = dataList.tail.columnName + " " + dataList.tail.units;

                chartWhole.AxisX.ScaleUnit = dataList.tail.data.Count / 10;

 

                chartWhole.RecalculateScale();

 

                // the x-axis contains values in date time format

                // set the x-axis labels to display date time instead of numbers

                for (int i = 0; i < dataList.tail.data.Count; i++)

                {

                    chartWhole.AxisX.Labels[i] = Convert.ToString(dataList.tail.data[i]);

                }

 

            }

 

            chartWhole.RecalculateScale();

        }

 

I use the Axis min and max values in a function that I took out the ZoomScrollBar example from the demo’s section of the ChartFX website. What I want to do in my project is exactly what is done in the ZoomScrollBar example. I want to create a highlighted selection on a main chart, and have a second chart perform a zoomed in version on the selection. Here is the code I took and modified from the ZoomScrollBar example:

 

        /// <summary>

        /// This method creates the AxisSection. AxisSection highlights part of the chart, given a from and a to.

        /// We will use this to indicate what part of the whole chart we are analyzing.

        /// </summary>

        private void CreateAxisSection()

        {

            Section = new AxisSection();

            chartWhole.AxisX.Sections.Add(Section);

            Section.BackColor = Color.LightCyan;

            Section.FontStyle = FontStyle.Bold;

           

            // min and max values are not set properly here, always being set to 1.7976XXXXXXXXXXXXE+308 and -1.79769313486231E+308.

            Section.From = chartWhole.AxisX.Min;

            Section.To = chartWhole.AxisX.Min + ((chartWhole.AxisX.Max - chartWhole.AxisX.Min) * 0.2);

 

            ScrollSize = Section.To - Section.From;

        }

 

Putting my code together I have, I called plotGraph() first, to create my curves, and then I call CreateAxisSelection() right after to get my highlighted selection in. The min and max variables of my AxisX are always being set to 1.7976XXXXXXXXXXXXE+308 and -1.79769313486231E+308.

 

Just to test another thing out, in the ZoomScrollBar example, the chart data comes from a TextProvider, instead of a ListProvider. When I replaced the ListProvider in my PlotGraph() method with a TextProvider, the AxisX min and max are properly set. Which leads me to think that there is a problem when the data is presented in the form of a ListProvider.

 

What do you think?

 

 

Will Lo

Software Developer

Canada Tech

#7, 7875 - 48 Ave.

Red Deer, AB Canada, T4P 2K1

Office: 403-314-3659



Reply# 2 by: Randy Jimenez (Software FX) Date: 5/19/2009 7:32:49 PMEST
Dear Will Lo:

Thanks for contacting Software FX Support. My name is Randy Jimenez and I will be glad to help you.

The issue may be related to the moment you are making use of these properties. Could you please provide us with a sample code showing exactly how and where you are using them? Additionally, please let us know the version of Chart FX you are currently using.

Regards,

Randy Jimenez
Software FX Support


Reply# 1 by: Will Lo Date: 5/19/2009 4:51:48 PMEST

Hello Chart FX Support, my support number is: CFXSUPXXXXXXXXXXXX

 

I have a question regarding the initialization of the AxisX.min, AxisX.max, AxisY.min, and AxisY.max properties.

 

On the chart’s designer properties, I have the min and max values set to auto for both X and Y axes. My chart’s DataSource is a ListProvider. Currently, I am loading in 5 curves to plot.

I need to make use of the min and max properties of the chart, however, they are not being set to the actual min and max values of the data I am presenting it.

 

The Axis.Min value is 1.7976XXXXXXXXXXXXE+308 and the Axis.Max value is -1.79769313486231E+308. I am assuming these are the initialization values when the chart has no data.

 

Am I missing something to get the chart to automatically fill in the min and max values for the X and Y axes?

 

 

Will Lo

Software Developer

Canada Tech

#7, 7875 - 48 Ave.

Red Deer, AB Canada, T4P 2K1

Office: 403-314-3659



Copyright © 2009 Software FX, Inc. All Rights Reserved.