Need help on draw Y-coordinates values using CDXYChartMBS

  1. 2 months ago
    Edited 2 months ago

    Hi All,

    I am using CDXYChartMBS plugins to draw the chart bar.
    X - Coordinates: ("0", "10", "20", "30", "35", "50", "65","70", "80", "90", "100")
    Y - Coordinates: V, X, Y, Z

    Please refer the below screenshot. One tweak is after 30 of x- coordinates next values are 35, 50 and 65. After 65 again x- coordinates are starting from 70, 80 and so on.

    Below line of code and data i am using to draw the Y-Coordinates :
    data: array(12.0, 38, 32, 35)
    V: 32
    X: 35
    Y: 38
    Z: 12

    call c.addBarLayer(data, colors).setBorderColor(CDXYChartMBS.kTransparent, CDXYChartMBS.barLighting(0.15, 1.0))

    However, the x-coordinates chart bar is not displaying correctly in the graph.

    -image-

    Here the sample code for adding three custom lines:

    // The data for the bar chart
    dim data(-1) as double = array(85.0, 156, 179.5, 211, 123)
    
    // The labels for the bar chart
    dim labels(-1) as string = array("Mon", "Tue", "Wed", "Thu", "Fri")
    
    // Create a XYChart object of size 250 x 250 pixels
    dim c as new CDXYChartMBS(250, 250)
    
    // Set the plotarea at (30, 20) and of size 200 x 200 pixels
    call c.setPlotArea(30, 20, 200, 200)
    
    // Add a bar chart layer using the given data
    Call c.addBarLayer(data)
    
    // Set the labels on the x axis.
    Call c.xAxis.setLabels labels
    
    Dim NoLabels() As String
    Call c.yAxis.setLinearScale 0, 250, NoLabels
    
    // add custom labels
    Call c.yAxis.addLabel(120, "120")
    Call c.yAxis.addLabel(35, "35")
    Call c.yAxis.addLabel(65, "65")
    
    Backdrop=c.makeChartPicture
  2. Christian S

    May 19 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    You are putting names on the labels to confuse people?

  3. Hi Christian,

    I have uploaded the chart bar graph. Could you please have a look and Names in the label as per my requirements.

  4. Christian S

    May 19 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    I just see a scaling with 10 between the lines and you gave them labels.

  5. Hi Christian,

    Yes, scaling is 10 between the lines. However, As you see between 30 to 70, values are different ( "35", "50", "65"). How can I adjust the scaling? So that if X = 38 It will draw the chart bar properly.

  6. Here is my test case:

    Example:
    Suppose X coordinate data are (0, 10, 20, 30, 35, 50, 65, 70, 80). I wanted different scaling in the chart bar for the above values.
    As you see between 30 to 70, values are different ( "35", "50", "65"). How can I adjust the scaling?

    Any help would greatly be appreciated.

  7. Christian S

    May 22 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    We'll ask the company making ChartDirector as I don't know this.

  8. Edited 2 months ago

    Thanks, Christian for an update. Please notify us once there is an update.

  9. Christian S

    May 22 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    We got a suggestion to use AddLabel method for custom label positions:

    ' Add the labels
    labels = Array(0, 10, 20, 30, 35, 50, 65, 70, 80)
    For i = 0 to Ubound(labels)
      Call c.xAxis().addLabel(labels(i), labels(i))
    Next
  10. Alberto D

    May 22 Pre-Release Testers

    I have never seen a Chart with X values of 0, 10, 20, 30, 35, 50, 65, 70, 80, always fixed increments (instead of 35, 40, instead of 65, 60).

    I guess you are trying to instead of showing 35 on the 40 line, don't want to show line at 40 but show line at 35 with label 35, the same with 65 instead of 60, right?

  11. Christian S

    May 22 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Some people like to add additional label and line to show where peak values are in a line chart.

  12. Alberto D

    May 22 Pre-Release Testers

    @ChristianSchmitz Some people like to add additional label and line to show where peak values are in a line chart.

    That I understand. I was thinking that the OP wanted to remove 40 and 60, instead of adding 35 and 65.

  13. Christian S

    May 22 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    he may need to make chart with no labels and than add all the custom labels as needed.

  14. Christian S

    May 23 Pre-Release Testers, Xojo Pro, XDC Speakers Answer Germany

    Here the sample code for adding three custom lines:

    // The data for the bar chart
    dim data(-1) as double = array(85.0, 156, 179.5, 211, 123)
    
    // The labels for the bar chart
    dim labels(-1) as string = array("Mon", "Tue", "Wed", "Thu", "Fri")
    
    // Create a XYChart object of size 250 x 250 pixels
    dim c as new CDXYChartMBS(250, 250)
    
    // Set the plotarea at (30, 20) and of size 200 x 200 pixels
    call c.setPlotArea(30, 20, 200, 200)
    
    // Add a bar chart layer using the given data
    Call c.addBarLayer(data)
    
    // Set the labels on the x axis.
    Call c.xAxis.setLabels labels
    
    Dim NoLabels() As String
    Call c.yAxis.setLinearScale 0, 250, NoLabels
    
    // add custom labels
    Call c.yAxis.addLabel(120, "120")
    Call c.yAxis.addLabel(35, "35")
    Call c.yAxis.addLabel(65, "65")
    
    Backdrop=c.makeChartPicture
  15. Edited 2 months ago

    Thanks, Christian after your quick response. I will verify and update you. I really appreciated your help. Cheers!!

or Sign Up to reply!