Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Logarithmic grid lines : possible?

Last post 08-05-2008 15:48 by Olestra. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 04-29-2008 9:10

    • MyGraph
    • Not Ranked
    • Joined on 04-29-2008
    • Points 95

    Logarithmic grid lines : possible?

     Hello,

    How can I use UltraChart with logarithmic grid lines for X or Y axes? I'm not speaking of logarithmic scale for X or Y axis, but to draw the grid itself, like what's shown in http://en.wikipedia.org/wiki/Image:600px-LinLogScale.png

     

    Regards

    MG 

    • Post Points: 35
  • 05-01-2008 15:16 In reply to

    Re: Logarithmic grid lines : possible?

    Sure, first you need to enable the minor gridlines: chart.Axis.X.MinorGridLines.Visible = true;
    set the following properties under chart.Axis.X

    NumericAxisType = Logarithmic
    TickmarkStyle = DataInterval
    TickmarkInterval = 1
    RangeMin = 1
    RangeMax = 1000
    RangeType = Custom

    • Post Points: 20
  • 05-06-2008 12:43 In reply to

    • MyGraph
    • Not Ranked
    • Joined on 04-29-2008
    • Points 95

    Re: Logarithmic grid lines : possible?

    It works  -thanks!

     How with a logarithmic scale can I display a value of zero for ultraChart1.Axis.X.RangeMin? If I set it to zero, it triggers an exception (as it if was computing log(zero) rather than simply displaying the value), but if I set it to 1, it displays 1 as the min value...

    Am I missing something? 

    • Post Points: 20
  • 05-06-2008 17:35 In reply to

    Re: Logarithmic grid lines : possible?

    Set LogZero property under chart.Axis.X. This property was added in 7.3. If you're using an earlier version, you'll have to start your range with 1.
    http://help.infragistics.com/Help/NetAdvantage/NET/2007.3/CLR2.0/html/Win_Support_for_Zero_Data_Points_in_Charts_Having_Logarithmic_Axes_Whats_New_20073.html

    • Post Points: 20
  • 05-07-2008 3:36 In reply to

    • MyGraph
    • Not Ranked
    • Joined on 04-29-2008
    • Points 95

    Re: Logarithmic grid lines : possible?

     Thks again for your answer. Yes, I'm using 7.3. Yet, even if I set the LogZero property (before or after setting NumericAxisType = NumericAxisType.Logarithmic), I still get an exception

    - either if I have a value of 0 in my datasource,

    - or if I set ultraChart1.Axis.X.RangeMin = 0.

     

    What do I do wrong?

    • Post Points: 20
  • 05-14-2008 17:29 In reply to

    Re: Logarithmic grid lines : possible?

    I can't reproduce the first problem (having 0s in the datasource). Have you tried installing the latest hotfix?
    Setting RangeMin to 0 on a logarithmic axis with RangeType=Custom will not work, unfortunately. LogZero was only designed to modify the zero values on the data. You can submit a feature request here, if you want this included in the future chart releases:
    http://devcenter.infragistics.com/protected/requestfeature.aspx

     

    • Post Points: 5
  • 08-04-2008 17:51 In reply to

    • Olestra
    • Not Ranked
    • Joined on 07-30-2008
    • Points 65

    Re: Logarithmic grid lines : possible?

    Hi,

    I'm also trying to plot a lin-log scale using Infragistics 7.1.20071.1055.  I read somewhere that there is a bug with the log scale that may be present in this version.  Can someone confirm this?

    As a test, I've tried plotting the values 10 to 7400 in increments of 10 (so, 10, 20, 30 etc) and setting the Y-Axis to linear and the X-Axis to logarithmic.  The result is I'm getting a plot that looks like the following:

    Sorry, it might be hard to see, I am having trouble figuring out how to get pictures to show up nicely on this forum...

    1. Why am I showing two lines, shouldn't the plot show something similar to the green plot in the Wikipedia link quoted above?

    2. How do I make the X-Axis grid lines at equal distance.

    My chart is using these properties:

    m_Chart->Axis->X->MinorGridLines->Visible = true;

    m_Chart->Axis->X->LogBase = 10;

    m_Chart->Axis->X->NumericAxisType = NumericAxisType::Logarithmic;

    m_Chart->Axis->X->Extent = 24;

    m_Chart->Axis->X->TickmarkIntervalType = AxisIntervalType::NotSet;

    m_Chart->Axis->X->TickmarkStyle = AxisTickStyle::DataInterval;

    m_Chart->Axis->X->TickmarkInterval = 1;

    m_Chart->Axis->X->RangeMin = 1.0;

    m_Chart->Axis->X->RangeMax = 1000.0;

    m_Chart->Axis->X->RangeType = AxisRangeType::Custom;

    • Post Points: 20
  • 08-05-2008 10:06 In reply to

    Re: Logarithmic grid lines : possible?

    This doesn't happen on my machine with 7.1.1055. I'm attaching an image of my chart. Perhaps you could paste a more complete code sample with data. As for the gridlines, use major gridlines instead of minor. Minor gridlines will never be equally spaced, just like they aren't in the wikipedia log plot. However, major gridlines will be.

    DataTable dt = new DataTable();
    dt.Columns.Add(
    "col1", typeof(int));
    dt.Columns.Add(
    "col2", typeof(int));
    for (int i = 10; i < 2000; i++)
    {
      dt.Rows.Add(
    new object[ { i, i*10 });
    }

    ultraChart1.ChartType = ChartType.ScatterChart;
    ultraChart1.Data.DataSource = dt;
    ultraChart1.ScatterChart.ColumnX = 0;
    ultraChart1.ScatterChart.ColumnY = 1;
    ultraChart1.Axis.X.NumericAxisType =
    NumericAxisType.Logarithmic;
    ultraChart1.Axis.X.TickmarkStyle =
    AxisTickStyle.DataInterval;
    ultraChart1.Axis.X.TickmarkInterval = 1;


    • Post Points: 20
  • 08-05-2008 13:45 In reply to

    • Olestra
    • Not Ranked
    • Joined on 07-30-2008
    • Points 65

    Re: Logarithmic grid lines : possible?

    I see.
    I was able to reproduce the graph that you have attached using the same data and using a ScatterChart.
    However, on my above chart, I was using a line chart and a Numeric Series.  I still get the chart with two lines and non-equally spaces X-Axis.
    NumericSeries pSeries = new NumericSeries();
    for (int i = 1; i < 75, ++i)
    {
      String sLabel = Convert.ToString( i*10 );
      pSeries.Points.Add( new NumericDataPoint( i*10, sLabel, false );
    }

    m_Chart.Axis.X.MajorGridLines.Visible = true;
    m_Chart.Axis.X.LogBase = 10;
    m_Chart.Axis.X.NumericAxisType = NumericAxisType.Logarithmic;
    m_Chart.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval;
    m_Chart.Axis.X.TickmarkInterval = 1;
    m_Chart.ChartType = ChartType.LineChart;
    m_Chart.Series.Clear();
    m_Chart.Series.Add( pSeries );

    Is there a way to get the same result with a LineChart?  Also, if I use scatter plot, can I get it to use the NumericDataSeries?

    Let me know if you need more code.

    • Post Points: 20
  • 08-05-2008 14:34 In reply to

    Re: Logarithmic grid lines : possible?

    Sorry, but LineChart types cannot use a numeric X axis. If you're using a line chart the x axis is a string type and every label is interpreted as a string. That's basically like taking a log of "apples". You should use a scatter chart and replace NumericSeries with XYSeries, where you have to specify the x and the y values. As for having a line, simply set chart.ScatterChart.ConnectWithLines = true

    • Post Points: 20
  • 08-05-2008 15:48 In reply to

    • Olestra
    • Not Ranked
    • Joined on 07-30-2008
    • Points 65

    Re: Logarithmic grid lines : possible?

    I'm now using XYSeries with ScatterPlot and it's working much better.  Thanks Max.

    • Post Points: 5
Page 1 of 1 (11 items)
Powered by Community Server (Commercial Edition), by Telligent Systems