2015-09-21 81 views
4

我有以下動態圖表(請參閱附圖)。爲了可重複性,我創建了一個基於標準icCube銷售模式的非常簡單的圖表。icCube - 在amCharts組合圖表的列中爲2維設置系列顏色

這個想法是在列軸上有選定年份的數據。爲了區分我想爲這些年來漸漸消失的事實分配顏色的事實。當你增加幾年時,新的一年會得到屬於這個事實的顏色,但是會變得更輕一點。下面的屏幕將會說明。

我的問題是:有沒有辦法做到這一點與amCharts /組合與關於MDC/icCube的設置?

附件中,你看到兩個圖表: this is what I intend

但是當我去選2008年,這種情況發生: this happens/ the issue

我已經包含了JSON這樣你就可以重現這個在銷售演示在一個普通的香草icCUbe 5.1.2安裝。

{ 
    "classID": "ic3.ReportGuts", 
    "guts_": { 
     "ic3Version": 12, 
     "schemaName": "Sales", 
     "cubeName": "Sales", 
     "layout": { 
      "classID": "ic3.FixedLayout", 
      "guts_": { 
       "ic3Version": 12, 
       "grid": 10, 
       "boxes": [ 
        { 
         "classID": "ic3.FixedLayoutBox", 
         "guts_": { 
          "ic3Version": 12, 
          "header": "chart with color serie that should match the selected fact (orange = Amount, blue = Amount_2)", 
          "behaviour": "Fixed Box", 
          "noPrint": false, 
          "position": { 
           "top": 100, 
           "left": 0, 
           "width": 1021, 
           "height": 421 
          }, 
          "widgetAdapterUid": "w12", 
          "zIndex": 2008 
         } 
        }, 
        { 
         "classID": "ic3.FixedLayoutBox", 
         "guts_": { 
          "ic3Version": 12, 
          "header": "select years", 
          "behaviour": "Fixed Box", 
          "noPrint": false, 
          "position": { 
           "top": 0, 
           "left": 60, 
           "width": 630, 
           "height": 80 
          }, 
          "widgetAdapterUid": "w14", 
          "zIndex": 2009 
         } 
        } 
       ], 
       "theme": "Classic", 
       "sizeIndicator": { 
        "width": 1024, 
        "height": 708 
       } 
      } 
     }, 
     "widgetMgr": { 
      "classID": "ic3.WidgetAdapterContainerMgr", 
      "guts_": { 
       "ic3Version": 12, 
       "items": [ 
        { 
         "classID": "ic3.AmchartsComboAdapter", 
         "guts_": { 
          "ic3Version": 12, 
          "navigationGuts": { 
           "classID": "ic3.AmChartsNavigationStrategy", 
           "guts_": { 
            "ic3Version": 12, 
            "menuVisibility": { 
             "back": true, 
             "axisXChange": "All", 
             "axisYChange": "All", 
             "filter": "All", 
             "reset": true, 
             "widget": true, 
             "others": "All" 
            }, 
            "maxAxisMemberCount": 10, 
            "selectionMode": "disabled", 
            "drillDownStrategy": { 
             "type": "mdxExpression", 
             "options": { 
              "drd_mdx": "order(nonempty($member.children, @{selMeasure}), @{selMeasure}, BDESC)" 
             } 
            } 
           } 
          }, 
          "ic3_name": "widget-1", 
          "ic3_uid": "w12", 
          "ic3_eventMapper": { 
           "classID": "ic3.EventWidgetMapper", 
           "guts_": { 
            "__ic3_widgetEventsDescription": {}, 
            "fireOnRefresh": { 
             "name": "All Events (default)", 
             "uniqueName": "all", 
             "parentRowId": -1, 
             "type": "OT" 
            }, 
            "ic3queryRefresh": "selDimensie" 
           } 
          }, 
          "ic3_mdxBuilderUid": "m6", 
          "__ic3_widgetTypeName": "amCharts/Combo", 
          "ic3extraOptions": ":{ \"categoryAxis\": {\n \"gridPosition\": \"middle\",\n \"gridAlpha\": 0,\n \"labelFunction\": function(valueText, serialDataItem, categoryAxis) {\n  return valueText.substr(0,10).replace(/\\s+/g, '<br>');\n }\n }\n\n }", 
          "graphs": [ 
           { 
            "lineThickness": 3, 
            "balloonText": "[[category]]<br>[[title]]: <b>[[fValue]]</b>" 
           } 
          ], 
          "ic3ChartType": [ 
           "column", 
           "column" 
          ], 
          "legendPosition": "bottom" 
         } 
        }, 
        { 
         "classID": "ic3.QueryFilterButtonListAdapter", 
         "guts_": { 
          "ic3Version": 12, 
          "ic3_name": "widget-0", 
          "ic3_uid": "w14", 
          "ic3_eventMapper": { 
           "classID": "ic3.EventWidgetMapper", 
           "guts_": { 
            "ic3selection": "selYear", 
            "__ic3_widgetEventsDescription": {} 
           } 
          }, 
          "ic3_mdxBuilderUid": "m1", 
          "__ic3_widgetTypeName": "icCube/Buttons", 
          "selectionMode": "multi", 
          "layout": "horizontal" 
         } 
        } 
       ] 
      } 
     }, 
     "constantMgr": { 
      "classID": "ic3.ConstantsMgr", 
      "guts_": { 
       "constant": [] 
      } 
     }, 
     "cssMgr": { 
      "classID": "ic3.CssMgr", 
      "guts_": {} 
     }, 
     "javascriptMgr": { 
      "classID": "ic3.ReportJavascriptMgr", 
      "guts_": { 
       "ic3Version": 12, 
       "js": "/**                  \n * A function called each time an event is generated.     \n *                  \n * @param context the same object is passed between consumeEvent calls. \n *    Can be used to store information.      \n *  {                \n *   $report : jQuery context of the report container   \n *   fireEvent : a function(name, value) triggering an event \n *  }                \n *                  \n * @param event the event information         \n *                  \n   {                \n *   name : as specified in the 'Events' tab      \n *   value : (optional) actual event value      \n *   type : (optional) e.g., ic3selection      \n *  }                \n *                  \n * Check the 'Report Event Names' menu for the list of available events. \n */                  \n/*                  \nfunction consumeEvent(context, event) {        \n if (event.name == 'ic3-report-init') {         \n // add your code here            \n }                  \n}                  \n*/                  \n" 
      } 
     }, 
     "calcMeasureMgr": { 
      "classID": "ic3.CalcMeasureMgr", 
      "guts_": { 
       "measures": [ 
        { 
         "name": "Amount2", 
         "expression": "1.1*[amount]", 
         "properties": null 
        } 
       ] 
      } 
     }, 
     "mdxQueriesMgr": { 
      "classID": "ic3.MdxQueriesContainerMgr", 
      "guts_": { 
       "mdxQueries": { 
        "classID": "ic3.BaseContainerMgr", 
        "guts_": { 
         "ic3Version": 12, 
         "items": [ 
          { 
           "classID": "ic3.QueryBuilderWidget", 
           "guts_": { 
            "mdxWizard": { 
             "classID": "ic3.QueryBuilderWizardForm", 
             "guts_": { 
              "rows": [ 
               { 
                "classID": "ic3.QueryBuilderHierarchyForm", 
                "guts_": { 
                 "hierarchy": { 
                  "name": "Product", 
                  "uniqueName": "[Product].[Product]" 
                 }, 
                 "type": "membersOfLevel", 
                 "membersOfLevel": "[Product].[Product].[Article]" 
                } 
               } 
              ], 
              "cols": [ 
               { 
                "classID": "ic3.QueryBuilderMeasuresFormBase", 
                "guts_": { 
                 "measures": [ 
                  { 
                   "name": "Amount", 
                   "uniqueName": "[Measures].[Amount]", 
                   "type": "ME" 
                  }, 
                  { 
                   "name": "Amount2", 
                   "uniqueName": "[Measures].[Amount2]", 
                   "type": "RCME" 
                  } 
                 ] 
                } 
               }, 
               { 
                "classID": "ic3.QueryBuilderEventsFilter", 
                "guts_": { 
                 "mdxStatement": "@{selYear}" 
                } 
               } 
              ], 
              "filters": [], 
              "nonEmptyOnRows": false, 
              "nonEmptyOnColumns": false 
             } 
            }, 
            "mdxFlat": { 
             "classID": "ic3.QueryBuilderFlatMdxForm", 
             "guts_": { 
              "useMdxStatement": false 
             } 
            }, 
            "ic3_name": "mdx Query-0", 
            "ic3_uid": "m6" 
           } 
          } 
         ] 
        } 
       }, 
       "mdxFilter": { 
        "classID": "ic3.BaseContainerMgr", 
        "guts_": { 
         "ic3Version": 12, 
         "items": [ 
          { 
           "classID": "ic3.NewFilterQueryBuilderForm", 
           "guts_": { 
            "hierarchy": { 
             "name": "Year", 
             "uniqueName": "[Time].[Year]" 
            }, 
            "type": "membersOfLevel", 
            "membersOfLevel": "[Time].[Year].[Year]", 
            "defaultsMdx": "2008,2009,2010", 
            "addDefaultMember": false, 
            "useAllMember": false, 
            "useDefaultMemberIfEmpty": false, 
            "ic3_name": "mdx Filter-0", 
            "ic3_uid": "m1" 
           } 
          } 
         ] 
        } 
       }, 
       "actionBuilders": { 
        "classID": "ic3.BaseContainerMgr", 
        "guts_": { 
         "ic3Version": 12, 
         "items": [] 
        } 
       } 
      } 
     } 
    } 
} 

回答

1

已經讀過,但沒有答案。我創建了以下解決方法:

  • 我修復顯示4年的總年總
  • 在MDX語句我

這是MDX語句使用:

WITH 
MEMBER [Time].[Year].[All-M].[_1] as null 
MEMBER [Time].[Year].[All-M].[_2] as null 
MEMBER [Time].[Year].[All-M].[_3] as null 
MEMBER [Measures].[Amount2] AS 1.1*[amount] 
SET [selection] as order(@{selYear},[Time].[Year].currentmember.key, bdesc) + 
    [Time].[Year].[All-M].[_1] + [Time].[Year].[All-M].[_2] + [Time].[Year].[All-M].[_3] 
SELECT {[measures].[Amount]} * [Time].[Year].[All-M].[_1] 
+ item(({[measures].[Amount]} * {[selection]}),3) 
+ item(({[measures].[Amount]} * {[selection]}),2) 
+ item(({[measures].[Amount]} * {[selection]}),1) 
+ item(({[measures].[Amount]} * {[selection]}),0) 
+ item(({[measures].[Amount2]} * {[selection]}),3) 
+ item(({[measures].[Amount2]} * {[selection]}),2) 
+ item(({[measures].[Amount2]} * {[selection]}),1) 
+ item(({[measures].[Amount2]} * {[selection]}),0) 
ON COLUMNS, 
{ [Product].[Product].[Article].allmembers } ON ROWS 
FROM [Sales] 

我不知道爲什麼我必須選擇第一個元組(金額* _1),但如果我不選擇它,我會得到一個MDX錯誤。

不過,我現在獲得完全調整圖表: ​​ 2 years selected

希望它可能是幫助他人。

2

在當前版本的報告(5.1.2)中是不可能的。我們在這裏尋找的是根據選擇使用不同的調色板。

您必須爲每列創建一個新的以指定valueField及其顏色。但列數正在變化,所以我們不知道應該定義多少個。

+0

它有助於重寫顯示結果集中的顏色的MDX嗎? WITH 會員[統計]。[統計 - 額外]。[顏色]作爲「#ff0000」 - 這將是一個公式我設備 成員[度量]。[金額2] AS 1.1 * [金額] 選擇 {[統計]。[統計額外]。[統計[額外]。[值],[統計]。[統計 - 額外]。[顏色]} * {{[度量]。[量],[度量]。[計數]}} * {{[時間]。 [Year]。[Year]。[2008],[Time]。[Year]。[Year]。&[2009],[Time]。[Year]。[Year]。&[2010]}} ON COLUMNS , {[Product]。[Product]。[Article] .allmembers} ON ROWS FROM [Sales] – Arthur

+0

我也可以將顏色存儲在單元格的背景屬性中。這會成爲解決這個問題的「鉤子」嗎? – Arthur

+0

是的,你可以在'graph'中指定'colorField',並在那裏放置列名 –

0

在當前版本中,您可以使用主題調色板或成員(@ Ic3Color)中MDX級別定義的顏色作爲列顏色。要激活第二個選項,請在報告中設置「使用MDX成員顏色」標誌。

在您的示例中,它更像是一個單元格屬性,用於設置表中的動態顏色(請參閱example)。對不起,目前沒有簡單的方法將單元格的屬性與圖表的列填充顏色綁定。

相關問題