SngSpreadGreen = (m_Color2RGB(m_lngSpectrum(m_lngCountColor), Green) - sngGreen) / m_lngCountColor SngSpreadRed = (m_Color2RGB(m_lngSpectrum(m_lngCountColor), Red) - sngRed) / m_lngCountColor SngBlue = CSng(m_Color2RGB(m_lngSpectrum(1), Blue)) SngGreen = CSng(m_Color2RGB(m_lngSpectrum(1), Green)) SngRed = CSng(m_Color2RGB(m_lngSpectrum(1), Red)) M_lngSpectrum(m_lngCountColor) = m_lngEndColor ReDim m_lngSpectrum(m_lngCountColor) As Long Set shpMarker = ActiveSheet.Shapes("Marker") Sub UsingCustomMarkers(Spectrum As CSpectrum, Cht As Chart) MarkerForegroundColor = Spectrum.SpectrumColor(lngIndex) MarkerBackgroundColor = Spectrum.SpectrumColor(lngIndex) LngIndex = intPoint * (Spectrum.Count / .Points.Count) Sub UsingMarkers(Spectrum As CSpectrum, Cht As Chart) UsingCustomMarkers clsSpectrum, ActiveSheet.ChartObjects(2).Chart UsingMarkers clsSpectrum, ActiveSheet.ChartObjects(1).Chart You can also specify the number ofĬolors to define within the span. To name the autoshape select it and enter the new name in the Name box next
#Create xy scatter chart excel code
The code below to work you will need to create 2 charts and insert aĪutoshape onto a worksheet. The Start and finish colors and the number of steps between. Marker is not restricted by the color palette so the coloration is smoother.Ĭolor according to the points order within the data series. Second chart uses an autoshape as a custom marker.
Standard xy scatter plot where the plot order of each data point determinesĭata markers color but due to the limit of the color palette it produces a