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
45
How do you create a log-log plot using UltraChart?
posted

I'm trying to create a log-log plot using UltraChart.  I have 1 independent variable and 3 dependent variables.  The values on the Y axis are looking fine, but the X axis is not working.

 Here's my code: 

        public IDataGraph(int nval, double[ xValues, double[ yObsValues, double[ yFitValues, double val63)

        {

            InitializeComponent();

 

            this.Graph1.ChartType = ChartType.LineChart;

 

            // X-Axis

            this.Graph1.Axis.X.Labels.ItemFormat = AxisItemLabelFormat.DataValue;

            this.Graph1.Axis.X.NumericAxisType = NumericAxisType.Logarithmic;

            this.Graph1.Axis.X.LogBase = 10.0;

            this.Graph1.Axis.X.RangeMin = 10000;

            this.Graph1.Axis.X.RangeMax = 100000;

            this.Graph1.Axis.X.RangeType = AxisRangeType.Custom;

            this.Graph1.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval;

            this.Graph1.Axis.X.TickmarkInterval = 1;

            this.Graph1.Axis.X.Labels.ItemFormatString = "<DATA_VALUE:0>";

 

            // Y-Axis

            this.Graph1.Axis.Y.NumericAxisType = NumericAxisType.Logarithmic;

            this.Graph1.Axis.Y.LogBase = 10.0;

            this.Graph1.Axis.Y.RangeMin = 1;

            this.Graph1.Axis.Y.RangeMax = 10000;

            this.Graph1.Axis.Y.RangeType = AxisRangeType.Custom;

            this.Graph1.Axis.Y.TickmarkStyle = AxisTickStyle.DataInterval;

            this.Graph1.Axis.Y.TickmarkInterval = 1;

            this.Graph1.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:0>";

 

            this.Graph1.LineChart.DrawStyle = LineDrawStyle.Solid;

            this.Graph1.LineChart.Thickness = 4;

 

            DataTable table = new DataTable();

 

            // Add columns

            table.Columns.Add("X", typeof(double));

            table.Columns.Add("Y", typeof(double));

            table.Columns.Add("Y1", typeof(double));

            table.Columns.Add("Y2", typeof(double));

 

            // Bottom, top, and left titles

            this.Graph1.TitleBottom.HorizontalAlign = StringAlignment.Center;

            this.Graph1.TitleBottom.Text = "X-Axis";

            this.Graph1.Axis.X.Extent = 50; // Adjusts distance between axis and text

            this.Graph1.TitleTop.Text = "Title";

            this.Graph1.TitleTop.HorizontalAlign = StringAlignment.Center;

            this.Graph1.TitleLeft.HorizontalAlign = StringAlignment.Center;

            this.Graph1.TitleLeft.Text = "Y-Axis";

            this.Graph1.Axis.Y.Extent = 50; // Adjusts distance between axis and text

            this.Graph1.TitleLeft.Visible = true;

 

            // Add values

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

            {

                table.Rows.Add(new object[ {xValues[i], 100.0 * yObsValues[i], 100.0 * yFitValues[i], 100.0 * val63 });

            }

            this.Graph1.DataSource = table;

            this.Graph1.DataBind();

 

            // Events

            this.Resize += new EventHandler(DataGraph_Resize);

 

            // Resize

            this.SetSizes();

        }

 The plot created from the code contains no points or lines and the X axis has no data.  Basically, it's a blank chart with labels and a nice log scale on the Y axis..  Any help would be greatly appreciated!