2011-03-14

FoxCharts new release - with Double Y Axis

Just uploaded a new release of FoxCharts, that brings the so asked "double Y axis" charts as the main change.
Apart from that, 2 important fixes were applied:

  • Multicharts with negative values that were not being drawn correctly in some situations;
  • Line charts are drawn much faster (5x faster) when drawing with line caps (with shapes in the chart intersections);
  • Other small tweaks

         

        http://vfpx.codeplex.com/releases/view/18515

         

        Still waiting for some feedback to push it as the "Recommended download". Please test it and let me know how it goes.
        Originally I thought of making a special subclass of FoxCharts for this purpose, but at the end I decided to go through the hardest but best way, updating the whole class.

         

        Have a look at the sample "chartssample_builder_2y.scx" in the samples folder of FoxCharts
        Just some few but important comments:

        1. needs to use depth = 0 (max 2)
        2. preferrably 2 data lines, one using the left axis and the other for the 2nd
        3. set the legends to the top

         

        Pay attention to the new properties:

        • ChartType = 18          && the newest chart type
        • Fields(n).AxisIndex = 2 && to what axis the data will correspond (1 = default)
        • LegendPosition = 6      && top center

         

        Having this, now you are able to create a chart like this, with no effort:

         

        Below is a simple script showing how to achieve the chart below directly:

        create cursor sales( ; 
            chart1 i null, ;
            chart2 i null, ;
            legend c (30) NULL)

        insert into sales values (130,      0, "jan")
        insert into sales values (120,  25000, "feb")
        insert into sales values ( 45,  50000, "mar")
        insert into sales values ( 60,  75000, "apr")
        insert into sales values ( 75, 100000, "may")
        insert into sales values (110, 135000, "jun")

        set classlib to locfile("foxcharts.vcx")

        public oform as form
        oform = createobject("form")
        oform.newobject("ochart","foxcharts","foxcharts.vcx")

        local loChart as Foxcharts of "foxcharts.vcx"
        loChart = oForm.oChart

        with loChart
             .Backcolor = rgb(255,255,255)
             .BrushType = 2
             .ChartsCount = 2
             .ChartType = 18
             .ColorType = 1
             .Depth = 0
             .FieldAxis2 =
        'legend'
            
        .FieldLegend =
        'legend'
             .FontName =
        'verdana'
            
        .Height = 288
             .LegendPosition = 6
             .SourceAlias =
        'sales'
            
        .Width = 732

             with .subtitle
                  .caption =
        'chart subtitle'
            
        endwith

             with .title
                 
        .caption =
        'testing 2nd y axis'
                 
        .forecolor = rgb(0,128,255)
             endwith

             with .fields(1)
                  .axisindex = 1
                  .color = rgb(255,0,191)
                  .fieldvalue =
        'chart1'
                 
        .legend =
        'gr1'
                 
        .shape = 5
             endwith

             with .fields(2)
                  .axisindex = 2
                  .color = rgb(0,142,146)
                  .fieldvalue =
        'chart2'
                 
        .legend =
        'gr2'
                 
        .shape = 2  
        && 'vfpxicon.png'
            
        endwith

             loChart.DrawChart()     loChart.Visible = .t.


        endwith



        oForm.Width  = loChart.Width
        oForm.Height = loChart.Height
        oForm.Show()


        http://vfpx.codeplex.com/releases/view/18515



        Donations are welcome. I'm accepting donations from people that use foxcharts and would like to contribute. The donations for the FOXCHARTS project will not go to my pocket. Please make your donation to the Ceil Silver Ambassador fund, from SWFOX.


        http://www.swfox.net/ambassador.aspx 




        The ceil silver ambassador fund is intended to raise money from the vfp community to bring a developer to the southwest fox conference as an ambassador for the developers in his or her country. this gives the recipient the opportunity to meet and share experiences with developers attending southwest fox and gives other attendees the opportunity to learn about vfp development in the recipient's country.




         



        I received this great honor and oportunity in 2010, and would be happy to help them to offer this fantastic gift to more people. That was a terrific experience, I learned lots of things there, met most of my best partners, knew many new other great people and this brought lots of strength to keep working in these tools.



        http://www.swfox.net/ambassador.aspx

        1 comment:

        1. Greet, it is possible at higher volume painted values on X axis place down scroll bar for better lucidity? Thank you. I'm sorry its English. Karel.

          ReplyDelete