ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  4 quadrant mode - Axis range < 1
Posted by Raoul on Nov-09-2016 08:37
Hi Peter,

I have an XY scatter layer with the (0,0) location in the middle of the plot.  Depending on what scale the user selects, I adjust the X & Y minimum and maximum range values.  Everything works fine until I try to make the minimum / maximum less than 1.  Then I lose my 4 quadrant mode and the axis range doesn't seem to do what I want.  I threw together a quick example based on your scatter chart example.  In the code, if Scalemin and Scalemax are set to -1 and 1 (respectively) or "greater", then it works fine.  If you set them to -.5 and .5, then you only get quad 1 and the range goes from 0 to 100.

TIA

-Raoul

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

Friend Sub forumexample()

        ' The XY points for the scatter chart
        Dim dataX0() As Double = {0.2, -0.1, 6, 12, 14, 8, 13, 13, 16, 12, 10.5}
        Dim dataY0() As Double = {-0.4, 0.1, 80, 110, 110, 105, 130, 115, 170, 125, 125}

        Dim scalemin As Integer = -0.5
        Dim scalemax As Integer = 0.5

        ' Create an XYChart object
        Dim c As XYChart = New XYChart(350, 350, Chart.metalColor(&H9999DD), &H0, 1)
        c.setRoundedFrame(Chart.CColor(Main.BackColor))

        ' Set the plotarea
        c.setPlotArea(40, 50, 275, 275, &HFFFFFF, -1, -1, &HCCCCCC, &HCCCCCC)
        c.setClipping()

        ' Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
        ' grey (dddddd) background, black (000000) border, and a glass like raised effect.
        c.addTitle("Position Data [mrad]", "Times New Roman Bold Italic", 15
             ).setBackground(&HDDDDDD, &H0, Chart.glassEffect())

        ' Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15
        ' pixels between minor ticks. This shows more minor grid lines on the chart.
        c.xAxis().setTickDensity(75, 15)

        ' Set the axes width to 2 pixels
        c.xAxis().setWidth(2)
        c.yAxis().setWidth(2)

        c.xAxis().setLinearScale(scalemin, scalemax)
        c.yAxis().setLinearScale(scalemin, scalemax)
        c.xAxis.setAutoScale(0, 0)
        c.yAxis.setAutoScale(0, 0)
        c.yAxis.setRounding(False, False)
        c.xAxis.setRounding(False, False)
        c.setAxisAtOrigin(Chart.XYAxisAtOrigin, Chart.XAxisSymmetric + Chart.YAxisSymmetric)

        ' Add a scatter chart layer
        c.addScatterLayer(dataX0, dataY0, "", Chart.GlassSphereShape, 6, Chart.CColor(Color.Blue))

        ' Assign the chart to the WinChartViewer
        Main.WinChartViewer1.Chart = c

    End Sub

  Re: 4 quadrant mode - Axis range < 1
Posted by Peter Kwan on Nov-09-2016 17:32
Hi Raoul,

In your code, both scalemin and scalemax is set to 0, because they are declared as "Integer".

As an axis scale of 0 to 0 is invalid (ChartDirector just replaced it with the default scale of 0 to 100.

If you need to use fractional values for scalemin and scalemax, you may declare them as "Double" instead of "Integer".

Hope this can help.

Regards
Peter Kwan

  Re: 4 quadrant mode - Axis range < 1
Posted by Raoul on Nov-10-2016 01:09
Thanks Peter.  I'm an idiot... I am not sure how I didn't see that....

sorry to waste your time on that one...

-R