Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Same Row values on X-axis are overrided

  1. #1
    Join Date
    Dec 2012
    Posts
    121

    Default Same Row values on X-axis are overrided

    Hi all,
    i have a barchart CCC2.
    I have an mdx query which plot on rows the months' numbers.
    However, if I make a filter on two years, I obtain only the months of a single year because the months' labels overlap.

    Is there a way to avoid this?

    Thanks in advance.
    Yamas

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    Executive Summary
    (Don't read this, if you prefer feeling the suspense)
    CCCv2 groups rows of equal category and sums the corresponding values.
    Skip to the solutions, below.

    What is going on?
    Internally CCC2 stores data as a "list" of datum.s.

    If the data source is in:

    • relational format (crosstabMode=false): there will be one datum per input row
    • cross-tab format (crosstabMode=true): there will be one datum per input row and "series" column


    Categorical charts
    (all but MetricDot/Line, Bullet, Pie, Treemap, Parallel Coordinates and DataTree)

    All categorical charts:
    • have a discrete base axis that:
      • shows the data of the category visual role,
        • whose data, by default, is taken from the dimensions named "categoryn" (ex: category, category, 2, category3, ...).


    Axis ticks are generated per category value
    Also, the base axis will generate one tick per distinct category visual role value.

    This means that two datums having the same category, would end up being shown in the same base axis position, overlapping each other.
    Instead, in categorical charts, both datums will generate a single bar (or other visual element type).
    The value of the bar will be the sum of the value of each of the datums.

    And the solution is...
    If you really want to keep things separate, then just don't give them equal values :-)

    Return your months in a format like: "2012-01", "2012-02", "2013-01", "2013-02".

    Then, if you want to, you can format the "Period" dimension to show only the month.

    Bar charts support treating the category values in two ways: as discrete (default) or as time-series.
    In the later, bars will still be drawn in equally sized bands.
    But you will gain 3 things:

    • The category values are JavaScript Date objects
    • The category values appear formatted in the tooltip
    • The discrete base axis labels are formatted as if the axis were continuous, by choosing an appropriate precision dependent on the values' date-span


    As Timeseries
    Code:
    timeSeries: true,
    timeSeriesFormat: "%Y-%m", // parsing format
    As Discrete
    Place this in the CDE chart's postFetch handler:
    Code:
    function f(data) {
    
        // Configure the category dimension
        this.chartDefinition.dimensions = {
            category: {
                 label: "Period"
                 formatter: function(v){ return v == null ? "" : ("" + parseFloat(v.substr(5))); } // extract month, remove zero-prefix, if any
            }
        };
    
        return data;
    }
    Last edited by duarte.leao; 04-12-2013 at 01:41 PM.

  3. #3
    Join Date
    Jan 2013
    Posts
    10

    Default

    loool! the chart is too complicated to understand i want a bit simpler one to get knowledgable now on........./............./.............
    Last edited by LidiaSchreck; 05-20-2013 at 07:57 AM.
    check this link >>> Harbor Freight Coupon


  4. #4
    Join Date
    Mar 2012
    Posts
    645

    Default

    LidiaSchreck,

    this is not your first response with a destructive tone.
    Do you have anything positive to add?
    Do you have any particular question to make?
    Were you able to, or tried to, understand this thread's problem?

    Now, a constructive answer to your comment.

    You don't need to understand every piece of functionality that CCCv2 has to offer.
    All things have a certain minimum level of complexity - it's not necessarily CCC that makes them overly complex.
    If you find that CCC "complexified" something, please provide an alternative solution.

    If you find it too hard, don't try to understand the problems that you are not experiencing directly. You will probably fail to find enough motivation to tackle them.
    Experiment with CDE and CCC charts. Use them.
    When there is something you can't accomplish, you'll find motivated and helpful people here to provide you free assistance.

  5. #5
    Join Date
    Dec 2012
    Posts
    121

    Default

    Hi duarte.leao,
    as always you made complete and very documented answers.
    However, i think the problem is on my query because i cannot change my data in post fetch.
    I explain better. I receive from the query the following rows:
    0,1,2, ecc., 0,1,2..
    Each number is a month (0=January,1=February, etc.). However, i cannot change the label on the rows because i don't have this information.
    But i think i can change my MDX query, which insert on ROW a range interval.
    I post the query:

    with
    set [filter_polygon] as '{[Localita.default].[All Localita.defaults]}'

    set [filter_loc] as '{ ${p_loc_type} }'
    set [filter_conn] as '{ ${p_conn_type} }'
    set [filter_dev_type] as '{ ${p_dev_type} }'
    set [filter_dev_model] as '{ ${p_device_model} }'
    set [filter_date] as '

    IIF( "${p_aggreg_time}" MATCHES "YEARLY",
    {ANCESTOR([Tempo.default].[${p_start_year}],[Tempo.default].[year]):ANCESTOR([Tempo.default].[${p_end_year}],[Tempo.default].[year])},
    IIF( "${p_aggreg_time}" MATCHES "MONTHLY",
    {[Tempo.default].[${p_start_year}].[${p_start_month}]:[Tempo.default].[${p_end_year}].[${p_end_month}]},
    IIF( "${p_aggreg_time}" MATCHES "WEEKLY",
    {[Tempo.YW].[${p_start_year}].[${p_start_week}]:[Tempo.YW].[${p_end_year}].[${p_end_week}]},
    {ANCESTOR([Tempo.default].[${p_start_year}].[${p_start_month}].[${p_start_day}],[Tempo.default].[day]):ANCESTOR([Tempo.default].[${p_end_year}].[${p_end_month}].[${p_end_day}],[Tempo.default].[day])}

    )
    )//secondo if
    )'//primo if

    set [filter_totale] as 'IIF( "${p_device_model}" MATCHES ".*AllMembers", [filter_polygon]*[filter_loc]*[filter_conn]*[filter_dev_type], [filter_polygon]*[filter_loc]*[filter_conn]*[filter_dev_type]*[filter_dev_model])'

    select

    UNION(
    UNION(
    UNION(
    Crossjoin({[Measures].[Latenza Media]}, [Operatore.default].[operatore].Members),
    Crossjoin({[Measures].[Latenza Massima]}, [Operatore.default].[operatore].Members)),
    Crossjoin({[Measures].[Numero Device]}, [Operatore.default].[operatore].Members)),
    Crossjoin([Measures].[Numero Test] , [Operatore.default].[operatore].Members))
    ON COLUMNS,
    {[filter_date]} ON ROWS
    from [WindCube2]
    where [filter_totale]



    Suppose to consider the filer_date in bold...what's the syntax to obtain the full name of each member ([year].[month])?

    Yamas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.