Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FacetChart X-Axis label overlapping

    SmartGWTPro 4.0 4/20/2014 build

    With Zoom enabled, setting the zoom window to certain size causes the X-Axis labels on the main chart to overlap. See attached image.

    This works most of the time, but when I change the zoom window to be a certain size (I'm guessing relative to the width of the whole chart) the main chart generate overlapping labels.

    Test driver below. Note, I used a custom ValueFormatter for XAxis label to make the label extra long with extra junk text to help with testing. In our real life application, we have other long meaningful text.

    Code:
    public class SmartGwtTester implements EntryPoint {
    	public void onModuleLoad() {
    		final FacetChart chart = new FacetChart();  
    		chart.setData(ChartData.getData());  
    		chart.setID("chart");  
    		chart.setWidth100();
    		chart.setHeight(550);  
    		chart.setFacets(new Facet("Time"));  
    		chart.setValueProperty("value");  
    		chart.setChartType(ChartType.LINE);
    		chart.setDataColors("#0000FF");
    		DrawLine dataLineProperties = new DrawLine();
    		dataLineProperties.setLineWidth(1);
    		chart.setDataLineProperties(dataLineProperties);
    		chart.setShowDataPoints(true);
    		chart.setTitle("Line Chart with SmartGwt v" + Version.getVersion() + " build: " + Version.getBuildDate());  
    		chart.setCanZoom(true);
    		chart.setLabelCollapseMode(LabelCollapseMode.NUMERIC);  
    		chart.setShowLegend(false);
    		chart.setMinLabelGap(10);
    		chart.setRotateLabels(LabelRotationMode.NEVER);
    		chart.setXAxisValueFormatter(new ValueFormatter() {
    			@Override
    			public String format(Object value) {
    				if(value instanceof Number){
    					return ((Number)value).toString() + " Extra Extra Extra Extra Extra Extra";
    				}
    				return null;
    			}
    		});
    		chart.addZoomChangedHandler(new ZoomChangedHandler() {
    			@Override
    			public void onZoomChanged(ZoomChangedEvent event) {
    				System.out.println("Zoom range: " + event.getStartValue() + ", " + event.getEndValue());
    			}
    		});
    		
    		FacetChart zoomChart = new FacetChart();
    		zoomChart.setLogScale(false);	// this line breaks the zoom chart flatline fix
    		
            chart.setZoomChartProperties(zoomChart);
            chart.setZoomSelectionChartProperties(zoomChart);
    		VLayout layout = new VLayout(15);
    		layout.setWidth(1600);
    		layout.setMembers(chart);  
    
    		chart.setZoomStartValue(10001);
    		chart.setZoomEndValue(10670);
    		layout.draw();  
    	}
    
    	public static class ChartData extends Record {  
    
    		public ChartData(float time, float value) {  
    			setAttribute("Time", time);  
    			setAttribute("value", value);  
    		}  
    
    		public static ChartData[] getData() {  
    			return new ChartData[] {  
    					new ChartData(10001f, 10.0f),  
    					new ChartData(10002f, 10.0f),  
    					new ChartData(10003f, 10.0f),  
    					new ChartData(10004f, 10.0f),  
    
    					new ChartData(10005f, 10.0f),  
    					new ChartData(10006f, 10.0f),  
    					new ChartData(10007f, 10.0f),  
    					new ChartData(10008f, 10.0f),  
    
    					new ChartData(10009f, 10.0f),  
    					new ChartData(10010f, 10.0f),  
    					new ChartData(10011f, 10.0f),  
    					new ChartData(10012f, 10.0f),  
    
    					new ChartData(10013f, 10.0f),  
    					new ChartData(10014f, 10.0f),  
    					new ChartData(10015f, 10.0f),  
    					new ChartData(10016f, 10.0f),  
    
    					new ChartData(10017f, 10.0f),  
    					new ChartData(10018f, 10.0f),  
    					new ChartData(10019f, 10.0f),  
    					new ChartData(10020f, 10.0f),
    //					new ChartData(10021f, 10.1f), // uncomment so it's no longer a flat line, zoom chart will then show line
    					new ChartData(20020f, 10.0f),
    			};  
    		}  
    	}
    }
    Attached Files

    #2
    Thanks for the clear test case. This is fixed for tomorrow's affected builds.

    Comment


      #3
      Issue still exists

      As per the previous comment, the issue is supposed to be fixed already in SmartGWT. But exact same issue still exists.
      And the issue exists in zoomIn & zoomOut both stages.
      If I am not being able to find the solution for this & if it exists as per the previous comment then could you please post the usage ?
      Last edited by Pinki; 17 Mar 2015, 03:19. Reason: request for the solution if exists as per the previous comment

      Comment


        #4
        See the FAQ about what details you need to post. You have forgotten version, browser and many other things.

        Most likely, you are either testing a version that pre-dates this fix, or your usage is different from the previous poster's, in which case we need a test case that reproduces the problem.

        Comment


          #5
          Issue still exists

          - SmartGWT's version--> smartgwtee-5.0p
          I have downloaded GWT 5.0 (Latest patched version: Full-featured evaluation: 60 day free trial includes Smart GWT Java Server framework, Visual Builder, and all other non-preview features.) from the link:
          https://www.smartclient.com/product/download.jsp

          the above link provides a file named as "smartgwtee-5.0p", its "release_notes.html" file (I have uplaoded it as well) shows the highest version 3.1 instead of 5.x. As per this it seems like the version downloaded is pre-dates the fix.
          In this could you please provide a direct link for the correct SmartGWTEE's latest version ?


          - Browser: Google Chrome (Version 41.0.2272.89 m)

          - There is no error/exception, I have added following 2 statements in my Facet extended class:
          setCanZoom(true); (to provide zoom feature)
          setRotateLabels(LabelRotationMode.NEVER); (to show all labels in horizontal)



          Another query related to this:
          Is there any way to drop labels of x-axis in SmartGWT (to avoid overlapping). If yes then this might also be helpful.

          Comment


            #6
            The download page you linked to should give you the latest nightly build. You can also hit the builds page directly.

            You can check with version you're running by evaluating isc.version in the developer console (it is also shown statically at the bottom left of the developer console window).

            It is possible the release notes are out of date - we'll double check on this.

            Regards
            Isomorphic Software

            Comment


              #7
              Hi,

              First of all thanks for replying so quick.

              I downloaded the 5.1p version from the builds page's link sent by you, its Release_notes.html also shows the 3.1 as highest version included in that.

              Anyways, following resolves the issue of labels' overlapping:
              setRotateLabels(LabelRotationMode.NEVER); // to display in horizontal manner
              setLabelCollapseMode(LabelCollapseMode.SAMPLE); // dropping labels to avoid labels' overlapping issue

              But there is a small issue (ignorable one, but if it's resolved then would be a better result).
              Issue: sometimes there is so much gap between two labels where more labels can fit. So.. is there any way to display max. no. of possible labels (with the minimum gap) OR any way to control the gap between two labels?
              I tried with "setMinLabelGap(<anyInteger_like_3>)". But it doesn't work. Could you please help regarding this ?


              Thanks
              Pinki

              Comment


                #8
                Any luck regarding my previous comment?

                Thanks
                Pinki

                Comment


                  #9
                  Hi, I am currently using the smartgwtee-6.0p 60 day trial version.

                  Was there a solution to this issue? My x-axis labels are also very long strings, and they are still overlapping. However, I want to display all of the labels horizontally, not just some by using the labelCollapseMode. Is there a way to wrap the labels instead?

                  Thanks

                  Comment

                  Working...
                  X