Search code examples
xmloracle-apexanychart

Oracle Apex Chart: change label color


I'm trying to change the color of one the labels (on the x-axis) of my (any-)chart. I don't know if this is even possible but I've tried to do it with the costum XML option by creating styles and assigning them to the individual labels. However, this did not work out for me (probably because I did it wrong). In the following, you can find the current custom XML (without my attempt on the problem) and I hope you can help me with these questions:

1.) Is it possible to change the color of only one label and how?

2.) If so, is it possible to assign the color by the name of the label and not it's number? This is necessary because the order of the labels vary on the results in the chart.

Thanks in advance!

XML:

<charts>
    <chart plot_type="CategorizedHorizontal" name="chart_448800575176822696"> 
        <chart_settings>
            <title enabled="False" />
        <chart_background>
            <fill type="Solid" color="0xffffff" opacity="0"/>
            <border enabled="false"/>
            <corners type="Square"/>
        </chart_background>
        <data_plot_background></data_plot_background>

        <axes>

        <y_axis>
            <scale mode="Normal" minimum="0" maximum="100"/>
            <title>
                <text>Percentage</text>
                <font family="Tahoma" size="10" color="0x000000" />
            </title>
            <labels enabled="true" position="Outside">
                <font family="Tahoma" size="10" color="0x000000" />
                <format>
                    <![CDATA[{%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]>
                </format>
            </labels>
            <major_grid enabled="False"/>
            <minor_grid enabled="False"/>
        </y_axis>


        <x_axis>
            <scale mode="Normal" inverted="True"/>
            <title>
                <text>label</text>
                <font family="Tahoma" size="10" color="0x000000" />
            </title>
            <labels enabled="true" rotation="0" position="Outside">
                <font family="Tahoma" size="10" color="0x000000" />
                <format>
                    <![CDATA[{%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]>
                </format>
            </labels>
            <major_grid enabled="True" interlaced="false"><line color="Black"/></major_grid>
            <minor_grid enabled="True"></minor_grid>
        </x_axis>

        </axes>

     </chart_settings>

     <data_plot_settings enable_3d_mode="false" >
         <bar_series style="Silver">

         <tooltip_settings enabled="true">
         <format>
             <![CDATA[{%Name}{enabled:False} - {%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]>
         </format>
             <font family="Tahoma" size="10" color="0x000000" />
             <position anchor="Float" valign="Top" padding="10" />
         </tooltip_settings>

        <label_settings enabled="true" mode="Outside" multi_line_align="Center" rotation="90">
        <format>
            <![CDATA[{%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]>
        </format>
            <background enabled="false"/>
            <font family="Tahoma" size="10" color="0x000000" />
        </label_settings>

        <bar_style></bar_style>
        <marker_settings enabled="True" >
            <marker type="None" />
        </marker_settings>
        </bar_series>
        </data_plot_settings>#DATA#
    </chart>
</charts>


Solution

  • AnyChart6 doesn't provide the feature of customizing a single label of the axis. But you can add an additional custom axes label. Take a look at the following example and its code - http://6.anychart.com/products/anychart/docs/users-guide/Samples/sample-custom-axes-labels.html#html-view

    Also, you may learn more about adding custom labels in this article - http://6.anychart.com/products/anychart/docs/users-guide/index.html