Reputation: 660
If we specify the content of crosshairX in the 'plotarea' attribute, by default the color of whole text becomes black. I want to represent this text of crosshair in two different colors. For example, suppose my text is "2016 : 0.07 M", then '2016' should appear in blue color and '0.07 M' in red. How can we achieve this?
Upvotes: 4
Views: 181
Reputation: 2631
Full Disclosure, I'm a member of the ZingChart team.
I would need to know how you are displaying your text to have a more specific solution. Are you using the default plotLabel.text or do you have a user defined plotLabel.text? If so what is it set to?
Without knowing what you have defined for text I have taking the liberty to put together a demo of the different combinations of applying colors and text to a plotLabel.
There are a couple things happening here:
var myConfig = {
type: "line",
scaleX:{
values:['Mon','Tue','Wed','Th','Fri','Sat','Sun']
},
crosshairX:{
plotLabel:{
headerText:'<span style="color:#777">Header Text</span>',
text:'<span style="color:%color">%kv</span>: <span style="color:black">%v</span> Extra Text...',
color:'red'
}
},
series : [
{
values : [35,42,67,89,25,34,67]
},
{
values : [35,42,67,89,25,34,67].sort()
}
]
};
zingchart.render({
id : 'myChart',
data : myConfig,
height: 350,
width: '100%'
});
<!DOCTYPE html>
<html>
<head>
<!--Assets will be injected here on compile. Use the assets button above-->
<script src= "https://cdn.zingchart.com/zingchart.min.js"></script>
<script> zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";</script>
<!--Inject End-->
</head>
<body>
<div id='myChart'></div>
</body>
</html>
Upvotes: 3