Jump to content
Changes to the Jaspersoft community edition download ×

Combined chart with multiple splines on one axis - line color / dashStyle


anna.czubernat
Go to solution Solved by anna.czubernat,

Recommended Posts

Hi, 

I've created a combined chart with a stacked column chart on one axis and a stacked spline chart with 5 lines on the other axis but I have some problems with the style of the splines. 

First, one of the lines is thinner at the first and last x-axis value and I can't figure out why. 

Also, if  I change the dashStyle of one of the lines the other lines seem to have a dash in the background as well. 

Does anyone have an idea how to change that?

Thanks,

A.

 

JRXML:  

<hc:chart xmlns:hc="http://jaspersoft.com/highcharts"          xsi:schemaLocation="http://jaspersoft.com/highcharts                              http://jaspersoft.com/schema/highcharts.xsd"          type="StackedColumnSpline">   <hc:chartSetting name="default">      <hc:chartProperty name="title.text" value=""/>      <hc:chartProperty name="credits.enabled" value="false"/>      <hc:chartProperty name="credits.href" value=""/>      <hc:chartProperty name="credits.text" value=""/>      <hc:chartProperty name="yAxis.title.text" value=""/>      <hc:chartProperty name="chart.zoomType" value="xy"/>      <hc:chartProperty name="chart.events.load">         <hc:propertyExpression>            <![CDATA["function(){"+"this.yAxis[0].endOnTick=false;"+                                   "this.yAxis[1].endOnTick=false;"+                                   "this.yAxis[0]                                        .setExtremes(0,Math.max(this.yAxis[0]                                                                    .getExtremes().max,this.yAxis[1]                                                                    .getExtremes().max)                                                      ,true);"+                                   "this.yAxis[1]                                        .setExtremes(0,Math.max(this.yAxis[0]                                                                    .getExtremes().max,this.yAxis[1]                                                                    .getExtremes().max)                                                      ,true);"+                                   "}"]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="chart.animation">         <hc:propertyExpression>            <![CDATA[false]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="legend.enabled_customSimpleMode" value="true"/>      <hc:chartProperty name="legend.enabled">         <hc:propertyExpression>            <![CDATA[false]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="plotOptions.spline.marker.enabled_customSimpleMode"                        value="true"/>      <hc:chartProperty name="plotOptions.spline.marker.enabled">         <hc:propertyExpression>            <![CDATA[false]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="plotOptions.spline.dataLabels.enabled_customSimpleMode" value="true"/>      <hc:chartProperty name="plotOptions.spline.dataLabels.enabled">         <hc:propertyExpression>            <![CDATA[true]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="plotOptions.spline.dataLabels.formatter">         <hc:propertyExpression>            <![CDATA["function() { var len = this.series.data.length; if(this.point.x == len-1) {return this.series.name;} else return null;}"]]>         </hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="plotOptions.series.dataLabels.style.fontSize" value="10px"/>      <hc:chartProperty name="plotOptions.series.dataLabels.style.fontWeight" value="normal"/>      <hc:chartProperty name="plotOptions.series.dataLabels.style.textOutline" value="0px"/>      <hc:chartProperty name="plotOptions.series.dataLabels.style.color" value=""black""/>      <hc:chartProperty name="com.jaspersoft.jasperreports.highcharts.interactive" value="false"/>      <hc:chartProperty name="plotOptions.column.dataLabels.format">         <hc:propertyExpression><![CDATA["{point.label}"]]></hc:propertyExpression>      </hc:chartProperty>      <hc:chartProperty name="colors_customSimpleMode" value="true"/>      <hc:chartProperty name="colors">         <hc:propertyExpression>            <![CDATA[Arrays.asList("#FFFFFF","#f7a35c","#7cb5ec",                                   "#90ed7d","#434348","#e4d354","#2b908f")]]>         </hc:propertyExpression>      </hc:chartProperty>   </hc:chartSetting>   <hc:chartSetting name="yAxis">      <hc:chartProperty name="_jrAxisIndex">         <hc:propertyExpression>            <![CDATA[0]]>         </hc:propertyExpression>      </hc:chartProperty>   </hc:chartSetting>   <hc:chartSetting name="yAxis">      <hc:chartProperty name="_jrAxisIndex">         <hc:propertyExpression>            <![CDATA[0]]>         </hc:propertyExpression>      </hc:chartProperty>   </hc:chartSetting>   <dataAxis axis="Rows">      <axisLevel name="MONTH">         <labelExpression>            <![CDATA["Level Label expression"]]>         </labelExpression>         <axisLevelBucket order="None" class="java.lang.Comparable">            <bucketExpression>               <![CDATA[$F{MONTH}]]>            </bucketExpression>         </axisLevelBucket>      </axisLevel>   </dataAxis>   <dataAxis axis="Columns">      <axisLevel name="STACKRANK">         <labelExpression><![CDATA[]]></labelExpression>         <axisLevelBucket order="Descending" class="java.lang.Comparable">            <bucketExpression><![CDATA[$F{STACKRANK}]]></bucketExpression>            <labelExpression> <![CDATA[$F{TOOLTIP}]]>  </labelExpression>            <bucketProperty name="color">               <![CDATA[iF($F{STACKRANK}==2                           , "#D3D3D3"                           , IF(OR( AND($F{STACKRANK}>=3                                        , $F{STACKRANK}<=14)                                   ,AND($F{STACKRANK}>=27                                        , $F{STACKRANK}<=38)                                   ,AND($F{STACKRANK}>=51                                        , $F{STACKRANK}<=62)                                   ,AND($F{STACKRANK}>=75                                        , $F{STACKRANK}<=86)                                   ,AND($F{STACKRANK}>=99                                        , $F{STACKRANK}<=110))                           , "#7CB5EC"                           , "#90ED7D"))]]>            </bucketProperty>            <bucketProperty name="label">               <![CDATA[$F{LABEL}]]>            </bucketProperty>         </axisLevelBucket>      </axisLevel>   </dataAxis>   <multiAxisMeasure name="STACK" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>       </labelExpression>      <valueExpression><![CDATA[$F{STACK}]]></valueExpression>   </multiAxisMeasure>   <multiAxisMeasure name="CTC_7" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>       </labelExpression>      <valueExpression><![CDATA[$F{CTC_7}]]></valueExpression>   </multiAxisMeasure>   <multiAxisMeasure name="CTC_6" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>       </labelExpression>      <valueExpression><![CDATA[$F{CTC_6}]]></valueExpression>   </multiAxisMeasure>   <multiAxisMeasure name="CTC_5" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>       </labelExpression>      <valueExpression><![CDATA[$F{CTC_5}]]></valueExpression>   </multiAxisMeasure>   <multiAxisMeasure name="CTC_4" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>       </labelExpression>      <valueExpression><![CDATA[$F{CTC_4}]]></valueExpression>   </multiAxisMeasure>   <multiAxisMeasure name="QUALIFIER" class="java.lang.Number"                     calculation="Nothing">      <labelExpression><![CDATA[""]]>           </labelExpression>      <valueExpression><![CDATA[$F{QUALIFIER}]]></valueExpression>   </multiAxisMeasure>   </multiAxisData>   <hc:series name="STACK">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[0]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="dataLabels.enabled" valueType="Expression">            <hc:valueExpression><![CDATA[true]]></hc:valueExpression>         </hc:contributorProperty>      </hc:contributor>      <hc:contributor name="SeriesItemProperty">         <hc:contributorProperty name="color" valueType="Bucket" value="STACKRANK.color"/>         <hc:contributorProperty name="label" valueType="Bucket" value="STACKRANK.label"/>      </hc:contributor>   </hc:series>   <hc:series name="CTC_7">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[1]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="type" valueType="Constant" value="spline"/>         <hc:contributorProperty name="dashStyle" valueType="Constant" value="solid"/>      </hc:contributor>   </hc:series>   <hc:series name="CTC_6">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[1]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="type" valueType="Constant" value="spline"/>         <hc:contributorProperty name="dashStyle" valueType="Constant" value="solid"/>      </hc:contributor>   </hc:series>   <hc:series name="CTC_5">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[1]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="type" valueType="Constant" value="spline"/>         <hc:contributorProperty name="dashStyle" valueType="Constant" value="solid"/>      </hc:contributor>   </hc:series>   <hc:series name="CTC_4">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[1]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="type" valueType="Constant" value="spline"/>         <hc:contributorProperty name="dashStyle" valueType="Constant" value="solid"/>      </hc:contributor>   </hc:series>   <hc:series name="QUALIFIER">      <hc:contributor name="SeriesProperty">         <hc:contributorProperty name="yAxis" valueType="Expression">            <hc:valueExpression><![CDATA[1]]></hc:valueExpression>         </hc:contributorProperty>         <hc:contributorProperty name="type" valueType="Constant" value="spline"/>         <hc:contributorProperty name="dashStyle" valueType="Constant" value="dash"/>         <hc:contributorProperty name="color" valueType="Expression">            <hc:valueExpression><![CDATA["#000000"]]></hc:valueExpression>         </hc:contributorProperty>      </hc:contributor>   </hc:series>[/code]

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...